Re: Recv timeout notification from a non-blocking socket using IOCP?
- From: "Arkady Frenkel" <arkadyf@xxxxxxxxxxxxxxxx>
- Date: Thu, 16 Jun 2005 21:17:15 +0200
You can use select() which do have TO or set timer independantly
Arkady
"BCatlin" <BCatlin@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:2F620CA0-8C38-4EAA-9A87-6D6D87214E9E@xxxxxxxxxxxxxxxx
>I have a server that uses IO completion ports for socket event
>notification.
> I've got a set of threads hanging off a port and a bunch of accepted
> worker
> sockets that have been handed to the OS. I want to be able to call
> setsockopt to set SO_RCVTIMEO to 60000 (60 seconds) so that if the socket
> does not receive data within that time after being accepted then I can get
> notified (and in this case close the socket).
>
> Apparently SO_RCVTIMEO is not supported for non-blocking sockets, as per
> the
> MSDN API docs. But the docs don't indicate what IS supported. Yes, I can
> keep track of the connected sockets elsewhere and disconnect them if they
> hang around too long, but that seems like a hack to me. I would think
> that
> there is a way to tell the OS that I want to be notified when this
> happens.
>
> I have tried setting the option anyway (even though the docs say it won't
> work), and it doesn't work. I'm using GetQueuedCompletionStatus to read
> from
> the IOCP. I get notified of the accept event and I call WSARecv. I then
> get
> no more notifications. I haven't tried setting up an event in the
> WSAOVERLAPPED structure, but my understanding is that if the completion
> port
> isn't notified then the event won't be signaled either.
>
> Any help/thoughts/comments would be greatly appreciated...
>
> Thanks.
.
- References:
- Prev by Date: Re: XP SP2 Firewall rips my outgoing ACK for external KEEP_ALIVE
- Next by Date: Re: How to get the value of a socket's send buffer or recv buffer?
- Previous by thread: Re: Recv timeout notification from a non-blocking socket using IOCP?
- Next by thread: Re: Recv timeout notification from a non-blocking socket using IOCP?
- Index(es):
Relevant Pages
|