title: Prevent msg concatenation with asyncio sockets
body: <p>I am using the standard asyncio socket client boiler plate below:</p>
  
  <pre><code>import asyncio
  
  async def repetitive_client_request(message, loop):
      reader, writer = await asyncio.open_connection('127.0.0.1', 8888, loop=loop)
      while True:
          await asyncio.sleep(1)
          writer.write(message.encode())
          await writer.drain()
  
          data = await reader.read(100)
          print('Received: {}'.format(data.decode()))
  
          print('Close the socket')
          writer.close()
  
  message = 'hi'
  loop = asyncio.get_event_loop()
  loop.run_until_complete(repetitive_client_request(message, loop))
  loop.close()
  </code></pre>
  
  <p>97% of the time everything works fine, but occasionally successive requests are being concatenated into for example <code>'hihihihi'</code>. Somebody suggested this behaviour is not entirely uncommon with TCP. How can I change the above to UDP, and should this expect to solve the issue?</p>
  
  <p>Edit: Just found this in docs: <code>Changed in version 3.6: The socket option TCP_NODELAY is now set by default.</code>  So it appears its not Nagle responsible for this message concatenation.</p>