Client:
System.Net.IPHostEntry hostInfo = System.Net.Dns.GetHostEntry(System.Net.Dns.GetHostName());
System.Net.IPAddress myIP = hostInfo.AddressList[0];
System.Net.IPEndPoint myEP = new System.Net.IPEndPoint(myIP, 11000);
mySocket.Connect(myEP);
Server:
// Get the host IP info
IPHostEntry ipHostInfo = Dns.GetHostEntry(Dns.GetHostName());
// Grab me an IP...
IPAddress ipAddress = ipHostInfo.AddressList[0];
// Set the endpoint
IPEndPoint localEndPoint = new IPEndPoint(ipAddress, 11000);
// Make a new TCP/IP socket...
Socket myListener = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
// Bind socket to endpoint...
try
{
myListener.Bind(localEndPoint);
myListener.Listen(100);