title: how to connect two different computers in two different networks
body: <p>this code below is working fine between two computers on the same network but it doesn't work between two computers on two different networks and i have tried to use the public IP address </p>
  
  <p>clint </p>
  
  <pre><code>import socket               
  s = socket.socket()         
  port = 10000
  ip=input("what is ip : ")
  s.connect((ip, port))
  print (s.recv(1024))
  s.close 
  </code></pre>
  
  <p>server </p>
  
  <pre><code>import socket
  s = socket.socket()
  ip=socket.gethostbyname(socket.gethostname())
  print (ip)
  port = 10000           
  s.bind((ip, port))       
  s.listen(1)                 
  while True:
          c, addr = s.accept()
          print ('Got connection from', addr)
          c.send(bytes([int(1)]))
          c.close()       
  </code></pre>
  
  <p>this question have already been asked many times but all the answers i could found is that i have to do " port forwarding " with out any code examples how to do it in some of the answers they say i should download application that will do the port forwarding to me but i don't know how to use it then in my python code ? </p>