title: How to fix 'Can't assign requested address'. Even I tried many different port on mac with python
body: <p>I want to make a connection between a server and a client. Actually I don't have any knowledge about networking. So I tried to make below codes but when I run the codes always give same problem  'Can't assign requested address'.I need help to solve this problem and also some suggestion to begin networking with python 3</p>
  
  <p>Even I tried many different port it gives same error 49</p>
  
  <pre><code>import socket
  
  
  def Main():
      host = "78.188.213.49"
      port = 5000
  
      s = socket.socket()
      s.bind((host, port))
      c, addr = s.accept()
      print("Connection from: " + str(addr))
  
      while True:
          data = c.recv(1024).decode(('utf-8'))
          if not data:
              break
          print("From connected user: " + data)
          data = data.upper()
          print("Sending message: " + data)
          c.send(data.encode('utf-8'))
  
      s.close()
  
  if __name__ == '__main__':
      Main()
  </code></pre>