title: How do you flush Python sockets?
body: <p>I've written a server in Python that is meant to send data to the client in the form "Header:Message"</p>
  
  <p>I would like to be able to have each message sent individually so that the client will  need to perform minimal work in order to read the "header" and the "message"</p>
  
  <p>Unfortunately, I can't figure out how to properly flush a python socket so when I have multiple sends execute in quick succession the messages get lumped together in the socket buffer and sent as one big chunk.</p>
  
  <p>Example:</p>
  
  <p>Server sends...</p>
  
  <pre><code>socket.send ("header1:message1")
  socket.send ("header2:message2")
  socket.send ("header3:message3")
  </code></pre>
  
  <p>Client receives...
  "header1:message1header2:message2header3:message3"</p>
  
  <p>I'd like to receive three individual messages</p>
  
  <pre><code>header1:message1
  header2:message2
  header3:message3
  </code></pre>
  
  <p>I need a way to flush after each send</p>