I am trying to establish a server-client connection using sockets in C #. First, I try to establish a connection from the same computer and in the second step from different computers. I came across these posts for and. My question is about connecting to a client. I am trying to execute something like:
private static void StartClient()
{
try
{
IPHostEntry ipHostInfo = Dns.GetHostEntry("127.0.0.1:11000");
IPAddress ipAddress = ipHostInfo.AddressList[0];
IPEndPoint remoteEP = new IPEndPoint(ipAddress, port);
Socket client = new Socket(ipAddress.AddressFamily,
SocketType.Stream, ProtocolType.Tcp);
.......
}
However, I get the message:
NO such host is known in System.NEt.Dns.GetAddrInfo
What is my problem? Port 11000 is the same as what I use from the server. What should I add as hostEntry when I start locally and what when I start the client from another computer?
EDIT: When I change the line Dns.GetHostEntry("127.0.0.1:11000");to Dns.GetHostEntry("127.0.0.1");or Dns.GetHostEntry("serverIp");, I got the same message.
EDIT2: IP- , . ?