title: Python server only working on local wifi
body: <p>The code:</p>
  
  <pre><code>import socket, threading
  
  server = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
  
  server.bind(("my ipv4 from ipconfig", 12))
  
  server.listen(5)
  
  def client_handler(client_socket):
      request = client_socket.recv(100)
  
      print "[*] Received: " + request
  
      client_socket.close()
  
  while True:
      client, addr = server.accept()
      print "[*] Accepted connection from: %s:%d" % (addr[0], addr[1])
      servert = threading.Thread(target=client_handler, args=(client,))
      servert.start()
  </code></pre>
  
  <p>So the server seems to work fine locally but if i ask my friend on a different network to connect, it doesn't connect. I tried port forwarding from the router 
  <a href="http://i.stack.imgur.com/wSUir.png" rel="nofollow">http://i.stack.imgur.com/wSUir.png</a> ( cant post img apparently cause my_reputation &lt; 10)</p>
  
  <p>I also tried using the ip i get from the whatismyip website, but i get the error:</p>
  
  <blockquote>
    <p>error: [Errno 10049] The requested address is not valid in its context</p>
  </blockquote>
  
  <p>Any ideas on what i could do so other people can connect? Thanks.</p>