title: test python socket server by nc or telnet
body: <p>I have a simple socket server by python</p>
  
  <pre><code>#!/usr/bin/python3           # This is server.py file
  import socket                                         
  
  # create a socket object
  serversocket = socket.socket(
              socket.AF_INET, socket.SOCK_STREAM) 
  
  # get local machine name
  host = socket.gethostname()                           
  
  port = 2115                                           
  
  # bind to the port
  serversocket.bind((host, port))                                  
  
  # queue up to 5 requests
  serversocket.listen(5)                                           
  
  while True:
      # establish a connection
      clientsocket,addr = serversocket.accept()      
  
      print("Got a connection from %s" % str(addr))
  
      msg = serversocket.recv(1024)
      print (msg.decode('ascii'))
      clientsocket.close()
  </code></pre>
  
  <p>I want to test this server by nc or telnet for example </p>
  
  <pre><code>telnet 127.0.0.1 2115
  </code></pre>
  
  <p>but causes error
  but when i try to connect by another socket program written in python. works well</p>