title: Python keeping socket alive?
body: <p>Hey I'm working on a python project using sockets. Basically I want to loop a connection to a host for user input. Here is what I'm trying:
  <pre><code>
  while True:
      sock.connect((host, port))
      inputstring = " > "
      userInput = raw_input(inputstring)
      sock.send(userInput + '\r\n\r\n')
      recvdata = sock.recv(socksize)
      print(recvdata)
  </pre></code></p>
  
  <p>But when I loop the socket and try connecting to localhost on port 80 I get an error saying the transport endpoint is still connected or something like that. How can I eliminate that problem?</p>