title: Python socket error - recv() function
body: <p>I've been trying to code a simple chat server in Python, my code is as follows:</p>
  
  <pre><code>import socket
  import select
  
  port = 11222
  serverSocket = socket.socket(socket.AF_INET,socket.SOCK_STREAM)
  serverSocket.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1024)
  serverSocket.bind(('',port))
  serverSocket.listen(5)
  
  sockets=[serverSocket]
  print 'Server is started on port' , port,'\n'
  
  def acceptConn():
      newsock, addr = serverSocket.accept()
      sockets.append(newsock)
      newsock.send('You are now connected to the chat server\n')
      msg = 'Client joined',addr.__str__(),
      broadcast(msg, newsock)
  
  def broadcast(msg, sourceSocket):
      for s in sockets:
          if (s != serverSocket and s != sourceSocket):
              s.send(msg)
      print msg,
  
  
  while True:
      (sread, swrite, sexec)=select.select(sockets,[],[])
      for s in sread:
          if s == serverSocket:
              acceptConn()
          else:
              msg=s.recv(100) 
              if msg.rstrip() == "quit":
                  host,port=socket.getpeername()
                  msg = 'Client left' , (host,port)
                  broadcast(msg,s)
                  s.close()
                  sockets.remove(s)
                  del s
              else:
                  host,port=s.getpeername()
                  msg = s.recv(1024)
                  broadcast(msg,s)
                  continue
  </code></pre>
  
  <p>After running the server and connecting via telnet, the server reads single character and skips the next one. Example if I type Hello in telnet, server reads H l o.
  Any help please ?! :)</p>