[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: Using luasocket to read from the keyboard
- From: Diego Nehab <diego@...>
- Date: Sun, 8 Jun 2008 03:08:15 -0400 (EDT)
Disclamer: none of this is supported, so please don't blame
me for how crazy things are.
LuaSocket uses recv/send instead of read/write. The posix
manual says they are equivalent if no flags are used, which
is LuaSocket's case. On Windows, however, this will never
On the other hand, stdin is probably set to blocking mode,
so when there is nothing available, it recv will block until
all the data you need shows up. Also, keyboard input will be
buffered until you hit return, I guess.
If you really want to use keyboard:receive(), you have to
call setfd on a *connected* socket. The socket returned by
socket.tcp() does not support the receive method.