linux下如何设置一个socket为非阻塞方式?

以前在dos下面我用ioctl设置的,可是linux下面好像不行了
---------------------------------------------------------------

用fcntl
---------------------------------------------------------------

int flags = fcntl(socket, F_GETFL, 0);
fcntl(socket, F_SETFL, flags ¦ O_NONBLOCK);

Published At
Categories with 服务器类
Tagged with
comments powered by Disqus