How to read data from socket in Lua until no more data is available?

307 views Asked by At

I can't manage to read the data from a luasocket. If i read more than the available data, the function call keeps blocked waiting until the client decides to close.

https://github.com/StringManolo/LuaServer/blob/main/tmpServer.lua#L216

line, errorStr = clientObj:receive("*a")

I'm using this command to test:

$ curl -X POST -d "a=b" http://localhost:1337 -v

Got same problem using Chrome to send a request to the Lua server.

I tryied to read byte to byte, line to line, all, etc.

0

There are 0 answers