Marton Korosi

Marton Korosi

  • NA
  • 14
  • 35.3k

How to make TCP connection with .NET?

Jul 6 2012 4:44 PM
I have found sample codes to make TCP connection with .NET, however it works only on my computer (both client and server runs on the same computer) and uses localhost. 
I want to separate the client and server between different computers which are connected to the internet.

In the server's app. code there is:
TcpListener tcpServerListener = new TcpListener(IPAddress.Parse("127.0.0.1"), 4444);

and in the client's app. code there is:
TcpClient tcpClient = new TcpClient("localhost",4444); 


What IP address should I write insted of localhost in the codes above?


Answers (1)