[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Cancel read on socket
- Date: Mon, 26 May 2008 18:24:30 +0400
- From: osv at javad.com (Sergei Organov)
- Subject: Cancel read on socket
Leon Pollak <leonp at plris.com> writes:
> On Monday, 26 ?May 2008, Sergei Organov wrote:
> I studied the internet again.
> And again I am afraid that shutdown will not help - please, correct me if I am
> 1. shutdown seems not to cancel currently in progress "read" operation (which
> blocked the task now).
Well, I'm not sure about UDP sockets, but for TCP sockets it should cancel
read operation the same way as if remote end had closed connection, I
believe. Though the socket won't be useful for reading after that anyway.
Alternate approach to your problem could be to configure receive timeout
for the socket, like this:
setsockopt(s, SOL_SOCKET, SO_RCVTIMEO, &tv, len);