title: C# TCP IP Connection
body: <p>I have used this <a href="http://www.codeproject.com/Articles/1415/Introduction-to-TCP-client-server-in-C" rel="nofollow">link</a>. and when i try to connect two different machines 192.168.1.4 and 192.168.1.9. I changed this part in the server code</p>
  
  <pre><code>TcpListener myList = new TcpListener(IPAddress.Any, 27505);
  </code></pre>
  
  <p>instead of</p>
  
  <pre><code>IPAddress ipAd = IPAddress.Parse("192.168.1.9");
  TcpListener myList = new TcpListener(ipAd, 27505);
  </code></pre>
  
  <p>I get this error in the client</p>
  
  <pre><code>Unhandled Exception: System.Net.Sockets.SocketException: A connection attempt fa
  iled because the connected party did not properly respond after a period of time
  , or established connection failed because connected host has failed to respond
  192.168.1.4:8001
     at System.Net.Sockets.TcpClient.Connect(String hostname, Int32 port)
     at Client.Client.send() in C:\Users\John\Documents\Visual Studio 2010\Project
  s\Server Client\Client\Client.cs:line 111
     at Client.Client.Main(String[] args) in C:\Users\John\Documents\Visual Studio
   2010\Projects\Server Client\Client\Client.cs:line 147
  </code></pre>
  
  <p>I have tried to run them both on the same machine and it worked.
  How to fix it ?</p>