Re: Pending WSARecv do not return when closesocket() is called
- From: "Michael K. O'Neill" <MikeAThon2000@xxxxxxxxxxxxxxxxxx>
- Date: Wed, 21 Feb 2007 17:19:39 -0800
As a wild guess, try setting SO_UPDATE_ACCEPT_CONTEXT
See the AcceptEx documentation at
http://msdn2.microsoft.com/en-us/library/ms737524.aspx , about halfway down.
Incidentally, does closesocket() return SOCKET_ERROR? And if so what does
WSAGetLastError show?
<nibiru.meister@xxxxxxxxx> wrote in message
news:1172078570.999915.154820@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Hello everyone,
I have a mysterious problem with IOCP.
I wrote a simple telnet server which basically accepts connections and
on a successful connection start "cmd.exe" with I/O redirectoin so
that input from the client socket gets redirected to the input of
cmd.exe and the output of cmd.exe is sent back to the client socket.
The input/output to cmd.exe is done through a named pipe (I start
cmd.exe with I/O redirection).
All of this is done through 1 IOCP (socket send/read and named pipe
write/read).
Everything worked well when I was using synchronous accept, but then i
wanted to use AcceptEx so that everything will be asynchrnous, and
here i encountred a problem i'm not sure how to solve.
The asynch AcceptEx works ok, clients get connected and work alright,
the problem is when a client wants to disconnect. A client disconnects
normally by pressesing 'exit' which makes cmd.exe terminate which in
turn closes the named pipe it was using.
The pending read on that pipe returns with a failure and realizing the
pipe has ended it does a closesocket() on the socket received from
AcceptEx().
And the problem: The closesocket() doesn't fail the pending read on
the socket!!
The read operation continues to wait as if the socket handle hasn't
been closed.
I have checked everything i could, tried SO_LINGER with {0,0} , tried
shutdown() on the socket before closesocket(), double checked I am
doing a closesocket() on the right socket, and nothing makes the
pending read operation return (fail) when closesocket() is called on a
socket I received from AcceptEx().
Anyone have any idea what can cause this behaviour?
Thanks a lot.
.
- Follow-Ups:
- Re: Pending WSARecv do not return when closesocket() is called
- From: nibiru . meister
- Re: Pending WSARecv do not return when closesocket() is called
- References:
- Pending WSARecv do not return when closesocket() is called
- From: nibiru . meister
- Pending WSARecv do not return when closesocket() is called
- Prev by Date: Re: Vista different user login via SMB NTLMVv1 to PCShare
- Next by Date: Re: SetComputerName api and
- Previous by thread: Pending WSARecv do not return when closesocket() is called
- Next by thread: Re: Pending WSARecv do not return when closesocket() is called
- Index(es):
Relevant Pages
|