code: def main():
      ''' Run the server. '''
      try:
          ip = sys.argv[1]
          port = int(sys.argv[2])
      except (IndexError, ValueError):
          print('Usage: {} <BIND_IP> <PORT>'.format(sys.argv[0]))
          sys.exit(1)
  
      server = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
      server.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
      server.bind((ip, port))
      server.listen(0)
  
      try:
          while True:
              print('Waiting for connection...')
              (stream, addr) = server.accept()
              print('Client connected: {}:{}'.format(addr[0], addr[1]))
              handle_connection(stream)
              stream.shutdown(socket.SHUT_WR)
              stream.close()
      except KeyboardInterrupt:
          print('Received SIGINT: shutting down…'f main():
      ''' Run the server. '''
      try:
          ip = sys.argv[1]
          port = int(sys.argv[2])
      except (IndexError, ValueError):
          print('Usage: {} <BIND_IP> <PORT>'.format(sys.argv[0]))
          sys.exit(1)
  
      server = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
      server.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
      server.bind((ip, port))
      server.listen(0)
  
      try:
          while True:
              print('Waiting for connection...')
              (stream, addr) = server.accept()
              print('Client connected: {}:{}'.format(addr[0], addr[1]))
              handle_connection(stream)
              stream.shutdown(socket.SHUT_WR)
              stream.close()
      except KeyboardInterrupt:
          print('Received SIGINT: shutting down…')
docs: Run the server.