title: lua socket receive string of unknown length
body: <p>I have a socket server which listens for commands and responds to them. The responses are not always of the same length. In python the following code runs fine, even if the response from the server is smaller than 1024 Bytes.</p>
  
  <pre><code>import socket
  sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
  sock.connect(("localhost", 9999))
  sock.sendall(bytes("command\n", 'utf-8'))
  print(sock.recv(1024))
  </code></pre>
  
  <p>Now I want to translate this to an equivalent lua code. This is my attempt:</p>
  
  <pre><code>socket = require("socket")
  sock = socket.connect("localhost", 9999)
  sock:send("command\n")
  s, status, partial = sock:receive(1024)
  print(s)
  </code></pre>
  
  <p>Unfortunately, the receive call blocks, if there are less than 1024 Bytes sent. How does the python client find out that the transmission is over and why does the lua client still wait?</p>