[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: LuaSocket, Win32 and select()
- From: Diego Nehab <diego@...>
- Date: Thu, 27 Jan 2005 23:01:50 -0500 (EST)
> Relevant quotes from Posix:
Why are we quoting POSIX here? :) We are talking about WinSock.
Take a look at the appropriate manual.
"If no buffer space is available within the transport system to hold the
data to be transmitted, send will block unless the socket has been
placed in nonblocking mode. On nonblocking stream oriented sockets, the
number of bytes written can be between 1 and the requested length,
depending on buffer availability on both client and server computers.
The select, WSAAsyncSelect or WSAEventSelect functions can be used to
determine when it is possible to send more data."
"The parameter writefds identifies the sockets that are to be checked
for writability. If a socket is processing a connect call (nonblocking),
a socket is writeable if the connection establishment successfully
completes. If the socket is not processing a connect call, writability
means a send, sendto, or WSASendto are guaranteed to succeed. However,
they can block on a blocking socket if the len parameter exceeds the
amount of outgoing system buffer space available. It is not specified
how long these guarantees can be assumed to be valid, particularly in a
I am telling you that I call select, it returns the socket as writable,
I call send immediately after, and it returns EWOULDBLOCK. There is no
other thread using the socket. There is no problem with the connection.
Why do you insist this is not a bug?
How am I supposed to avoid busy wait in the presence of this bug?