lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


On Mon, Jun 22, 2009 at 11:59 AM, Francisco Sant'anna <francisco.santanna@gmail.com> wrote:
I missed the 3rd return value for `receive` in the documentation, quite simple.

Its easy to miss, and not completely documented. In particular, that there is always a partial string, but that it might have zero length, is not documented.

I couldn't also find in the API a way to check if the client connection with the server is still open.


How would you do that with the underlying C sockets API?

I have no idea.

This check is not a feature of TCP stacks, they don't send packets if there is no data to send or acknowledge, so the stack doesn't know if the server is down.

You can use client:setoption"keepalive", but should probably google for what that actually does, it likely does not work as you might wish.

If the socket was reset or shutdown by the server, select should indicate readable, if I recall correctly, and then when you read you will get an indication of error.

Cheers,
Sam