Wierd error
I''m trying to make a simple multithreaded client-server connection. The client can connect to the server. Then WSASend or WSARecv will return SOCKET_ERROR but a subsequent call to WSAGetLastError returns 0.
How is this possible?
maybe it is not error, there is nonblocking or overlapped socket functions.
WSARecv or WSASend was maintained in background.
So there is not error...
Good Luck
WSARecv or WSASend was maintained in background.
So there is not error...
Good Luck
Are you by any chance doing the following:
int err = WSARecv(...);
if ( err = SOCKET_ERROR ) //-- assignemnt, not compare
{
}
Otherwise I don''t see how you could get a null error on an error from a WSA call.
-cb
int err = WSARecv(...);
if ( err = SOCKET_ERROR ) //-- assignemnt, not compare
{
}
Otherwise I don''t see how you could get a null error on an error from a WSA call.
-cb
um...
so... that is not error [ blocking mode ]
it is possible in follow...
1. 0 bytes sending [or immediatly returned]
int WSASend(
SOCKET s,
LPWSABUF lpBuffers,
DWORD dwBufferCount,
LPDWORD lpNumberOfBytesSent,
DWORD dwFlags,
LPWSAOVERLAPPED lpOverlapped,
LPWSAOVERLAPPED_COMPLETION_ROUTINE lpCompletionRoutine
);
notice lpNumberOfBytesSent.
2. receving closing or connection SYNC with WSARecv
3. using Completion Routine
but...
i can''t see your situation as your said.
is sure blocking mode?
so... that is not error [ blocking mode ]
it is possible in follow...
1. 0 bytes sending [or immediatly returned]
int WSASend(
SOCKET s,
LPWSABUF lpBuffers,
DWORD dwBufferCount,
LPDWORD lpNumberOfBytesSent,
DWORD dwFlags,
LPWSAOVERLAPPED lpOverlapped,
LPWSAOVERLAPPED_COMPLETION_ROUTINE lpCompletionRoutine
);
notice lpNumberOfBytesSent.
2. receving closing or connection SYNC with WSARecv
3. using Completion Routine
but...
i can''t see your situation as your said.
is sure blocking mode?
ah. my mistake.
WSARecv, WSASend is not blocking API
understand? this is OVERLAPPED I/O, not blocking.
compare WSARecv and recv in WINSOCK.
if data was not incoming, WSARecv has returned but recv has not returned before data was incoming. In other words, recv has blocking mode until data was not incoming.
[edited by - veruna2k on May 19, 2003 11:11:49 PM]
WSARecv, WSASend is not blocking API
understand? this is OVERLAPPED I/O, not blocking.
compare WSARecv and recv in WINSOCK.
if data was not incoming, WSARecv has returned but recv has not returned before data was incoming. In other words, recv has blocking mode until data was not incoming.
[edited by - veruna2k on May 19, 2003 11:11:49 PM]
quote:
Original post by veruna2k
ah. my mistake.
WSARecv, WSASend is not blocking API
understand? this is OVERLAPPED I/O, not blocking.
compare WSARecv and recv in WINSOCK.
if data was not incoming, WSARecv has returned but recv has not returned before data was incoming. In other words, recv has blocking mode until data was not incoming.
[edited by - veruna2k on May 19, 2003 11:11:49 PM]
Wrong.
WSARecv/WSASend exhibit the exact same behaviour as recv/send when the lpOverlapped and lpCompletionRoutine parameters are set to NULL.
The error must have been something else.
[email=direwolf@digitalfiends.com]Dire Wolf[/email]
www.digitalfiends.com
www.digitalfiends.com
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement