lua-users home
lua-l archive

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


Hi,

Btw, do these examples seem weird?

No.

s=socket.connect("localhost", 80)
s:settimeout(0)
= s:receive(0)
nil     timeout

Either "timeout" or "" would be fine here.  Unless the
connection is closed, in which case you should receive the
notification.  My choice seems consistent with the behavior
below.

 s=socket.connect("localhost", 80)
= s:receive(0)
.... blocks forever....

What is it waiting for? Either return a zero-length string, or return
an argument error.

I think this is standard behavior. When and if new data
arrives, it will return you the empty string. Or when the
connection is closed, it will also let you know.

Regards,
Diego