Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Must recvfrom() wait forever?

251 views
Skip to first unread message

Carl Nelson

unread,
Sep 13, 1997, 3:00:00 AM9/13/97
to

Does anyone know if there is any way to cancel a recvfrom() call if
there is no data coming in to be read? Can I keep the socket open
afterwards?

Thanks for any help,
Carl Nelson
cn9...@american.edu


Ken Durbrow

unread,
Sep 17, 1997, 3:00:00 AM9/17/97
to

try:
int timeout = 500; // milliseconds

setsockopt(sock, SOL_SOCKET, SO_RCVTIMEO, (char *)&timeout, sizeof(int));

this will set the recv timeout to 1/2 second (500 milliseconds)

Carl Nelson <car...@iname.com> wrote in article
<341AE870...@iname.com>...

Xu Yifeng

unread,
Sep 19, 1997, 3:00:00 AM9/19/97
to

use function select, set timeout in its parameter.

Xu Yifeng

0 new messages