Torna al Thread

Socket CreateSocket(string machineAddress, int port) { IPHostEntry iphostEntry = null; iphostEntry = Dns.GetHostEntry(machineAddress); foreach (IPAddress address in iphostEntry.AddressList) { IPEndPoint ipe = new IPEndPoint(address.Address, port); Socket tempSocket = new Socket(ipe.AddressFamily, SocketType.Stream, ProtocolType.Tcp); tempSocket.Connect(ipe); if (tempSocket.Connected) { _state = StateConnection.CONNECTED.ToString(); return tempSocket; } } return null; }
Copyright © dotNetHell.it 2002-2024
Running on Windows Server 2008 R2 Standard, SQL Server 2012 & ASP.NET 3.5