设置socket为非阻塞
int flags = fcntl(SocketFd,F_GETFL,0);
fcntl(SocketFd,F_SETFL,O_NONBLOCK|flags);
恢复阻塞状态:
fcntl(SocketFd,F_SETFL,~O_NONBLOCK&flags); /*set the socket block*/
int flags = fcntl(SocketFd,F_GETFL,0);
fcntl(SocketFd,F_SETFL,O_NONBLOCK|flags);
恢复阻塞状态:
fcntl(SocketFd,F_SETFL,~O_NONBLOCK&flags); /*set the socket block*/