title: How to connect two computers on the same network using python
body: <p>This is the server side program</p>
  
  <pre><code>import socket
  
  s = socket.socket()
  host = socket.gethostname()
  port = 9077
  s.bind((host,port))
  s.listen(5)
  
  while True:
      c, addr = s.accept()
      print("Connection accepted from " + repr(addr[1]))
      c.send("Thank you for connecting")
      c.close()
  </code></pre>
  
  <p>This is the client program</p>
  
  <pre><code>import socket
  
  s = socket.socket()
  host = socket.gethostname()
  port = 9077
  s.connect((host, port))
  print s.recv(1024)
  </code></pre>
  
  <p>When i run these two programs on the <strong>same computer, it works perfectly.</strong>
  But when i run the client and server programs in <strong>two different computers on the same network, the program doesn't work.</strong></p>
  
  <p>Can anyone please tell me how to send message from one computer to another on the same network.</p>
  
  <p>This is the first time i'm doing any network programming. Any help would be appreciated</p>
  
  <p>Thanks in advance</p>