title: Python TCP Server, others can't connect only localhost or my local IP
body: <p><strong>My Server TCP Code:</strong></p>
  
  <pre><code>import socket
  import sys
  
  HOST = ''
  PORT = 8031
  s = socket.socket()
  
  class BoServer:
  
  
      def __init__(self):
          try:
              s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
          except socket.error,msg:
              print "Unable to create socket"
              sys.exit()
          print "Socket created."
      def bind(self):
          s.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
          try:
              s.bind((HOST,PORT))
          except socket.error,msg:
              print "Bind failed. Closing..."
              sys.exit()
          print "Socket bound."
      def run(self):
           s.listen(10)
           print "Socket Listening"
           conn, addr = s.accept()
           print "Connected to %s:%s"%(addr[0],addr[1])
           while True:
              income = conn.recv(4096)
              if income != "":
                  print income
  
  def main():
      serv = BoServer()
      serv.bind()
      serv.run()
  
  if __name__ == "__main__":
      main()
  </code></pre>
  
  <p><strong>My Client TCP Code:</strong></p>
  
  <pre><code>import socket
  import sys
  
  
  def main():
      host = ""
      port = 8031
      message = "Hello World!"
  
      host = raw_input("Enter IP: ")
      #Create Socket
      try:
          s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
      except socket.error, msg:
          print "Failed to create socket. Error code: %s Error Message: %s"%(str(msg[0]),msg[1])
          sys.exit()
      print "Socket created"
  
      #Connect to server
      s.connect((host,port))
  
      while message != "/e":
          #Send Data
          message = raw_input("Send &gt;&gt; ")
          try:
              s.sendall(message)
          except socket.error, msg:
              print "ERROR %s"%(msg[1])
              print "Failed to send."
      s.close()
  
  main()
  </code></pre>
  
  <p>I want to people write my public ip xxx.xxx.xxx.xx on the client and to connect at the server.</p>
  
  <p>When I run the Server, others can't connect to my Server. I can only access the server with localhost or my local IP.</p>
  
  <p>Everyone that tries to connect receive this ERROR:</p>
  
  <pre><code>Errno 10060] A connection attempt failed because the connected party did not properly respond after a period of time.
  </code></pre>
  
  <p>What am I doing wrong ?</p>