#ZHU MING# wrote:
>
> Hi,
>
> If O_NONBLOCK is not set on the socket's file descriptor,
> recvfrom() blocks until a message arrives. If no messages are
> available at the socket and O_NONBLOCK is set on
> the socket's file descriptor, recvfrom() fails and sets errno to EAGAIN.
>
> But how to set 0_NONBLOCK on the socket's file descriptor?
>
> Yours
> Zhu Ming
>
> -
> To unsubscribe from this list: send the line "unsubscribe linux-net" in
> the body of a message to [EMAIL PROTECTED]
void nonblock(int s) {
int flags;
flags = fcntl(s, F_GETFL);
flags |= O_NONBLOCK;
if (fcntl(s, F_SETFL, flags) < 0) {
VLOG << "ERROR: fcntl, executing nonblock: " << strerror(errno)
<< endl;
my_assert(FALSE);
}
}//nonblock
--
Ben Greear ([EMAIL PROTECTED]) http://www.candelatech.com
Author of ScryMUD: scry.wanfear.com 4444 (Released under GPL)
http://scry.wanfear.com http://scry.wanfear.com/~greear
-
To unsubscribe from this list: send the line "unsubscribe linux-net" in
the body of a message to [EMAIL PROTECTED]