Forums » Community Projects
WSAEWOULDBLOCK
This is perhaps the most annoying error code you could ever receive.
from msn.
WSAEWOULDBLOCK
10035
Resource temporarily unavailable.
This error is returned from operations on nonblocking sockets that cannot be completed immediately, for example recv when no data is queued to be read from the socket. It is a nonfatal error, and the operation should be retried later. It is normal for WSAEWOULDBLOCK to be reported as the result from calling connect on a nonblocking SOCK_STREAM socket, since some time must elapse for the connection to be established.
So anyone have a good way to handle this error?
Ed
from msn.
WSAEWOULDBLOCK
10035
Resource temporarily unavailable.
This error is returned from operations on nonblocking sockets that cannot be completed immediately, for example recv when no data is queued to be read from the socket. It is a nonfatal error, and the operation should be retried later. It is normal for WSAEWOULDBLOCK to be reported as the result from calling connect on a nonblocking SOCK_STREAM socket, since some time must elapse for the connection to be established.
So anyone have a good way to handle this error?
Ed
Yes, by buffering and setting read/write callbacks.
Are you still getting this in response to a connection, or is this in response to a send or receive call?
Are you still getting this in response to a connection, or is this in response to a send or receive call?
I make a connect attempt. the other side never receives the attempt.
Just learned the SetupLineInputHandlers function is never reached
Can you do me a favor and write a minimal test lua script which repeatably demonstrates this error? I'll need to look at the VO code to fix it.
:FIX:
the problem is the delay in connection. the WOULDBLOCK message means "some time must elapse for the connection to be established."
solution is to add a delay
in tcpsock.lua at:
local err = conn.tcp:GetSocketError()
if err then
if string.find(err,'WSAEWOULDBLOCK') then
for count = 1,1000000 do end
err = conn.tcp:GetSocketError()
end
end
the for loop on my test boxes yields 100% rsults each and every time with NO block message. I am also checking another type of loop as well.
A timer here would not work at all.
Ed
the problem is the delay in connection. the WOULDBLOCK message means "some time must elapse for the connection to be established."
solution is to add a delay
in tcpsock.lua at:
local err = conn.tcp:GetSocketError()
if err then
if string.find(err,'WSAEWOULDBLOCK') then
for count = 1,1000000 do end
err = conn.tcp:GetSocketError()
end
end
the for loop on my test boxes yields 100% rsults each and every time with NO block message. I am also checking another type of loop as well.
A timer here would not work at all.
Ed
Ray figured it out. The error it's getting is actually totally unrelated to the socket you are connecting with, since WinSock doesn't have a way to check the error status of a particular socket (or if it does, we're not using it). So... in my tcpsock.lua, inside the connecthandler callback in SetupLineInputHandlers, just delete the error checking (local err = conn.tcp:GetSocketError() stuff), since it won't work anyway under Windows.
The Vendetta client code regularly generates EWOULDBLOCK conditions, since it reads the UDP socket input until it would block.
The Vendetta client code regularly generates EWOULDBLOCK conditions, since it reads the UDP socket input until it would block.
that works as well.