title: Socket - Simple Server/Client - socket.error: [Errno 10060]
body: <p>I have a very simple Socket Server code running on port 9999.  When I fire up my server and client, with netstat I can see that the server is running and the client is on the ephemeral port of 7180. </p>
  
  <pre><code>TCP    192.168.1.117:9999     0.0.0.0:0              LISTENING       7180
  </code></pre>
  
  <p>However, the output of client shows this error:</p>
  
  <pre><code>Traceback (most recent call last):
    File "client.py", line 6, in &lt;module&gt;
      clisock.connect((host, 9999))
    File "C:\Python27\lib\socket.py", line 222, in meth
      return getattr(self._sock,name)(*args)
  socket.error: [Errno 10060] A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond
  </code></pre>
  
  <p>My server code:</p>
  
  <pre><code>import socket
  import sys
  import time
  
  srvsock = socket.socket (socket.AF_INET, socket.SOCK_STREAM)
  print 'Server Socket is Created'
  
  host = socket.gethostname()
  try:
      srvsock.bind( (host, 9999) )
  except socket.error ,  msg:
      print 'Bind failed. Error Code : ' + str(msg[0]) + ' Message ' + msg[1]
      sys.exit()
  
  srvsock.listen(5)
  print 'Socket is now listening'
  
  while True:
      clisock, (remhost, remport) = srvsock.accept()
      print 'Connected with ' + remhost + ':' + str(remport)
      currentTime = time.ctime(time.time()) + "\r\n"
      print currentTime
      clisock.send(currentTime)
  
  clisock.close()
  srvsock.close()
  </code></pre>
  
  <p>And my Socket client program is as follow:</p>
  
  <pre><code>import socket
  clisock = socket.socket (socket.AF_INET, socket.SOCK_STREAM)
  
  host = socket.gethostname()
  print host
  clisock.connect((host, 9999))
  
  
  tm = clisock.recv(1024)
  
  clisock.close()
  
  print tm
  </code></pre>
  
  <p>What is the issue? Could it be a Firewall or something which cause the connection to drop?</p>