c - 套接字的 FIONBIO 和 FIOASYNC 有什么区别?

标签 c asyncsocket

似乎这两个选项都可以用来使套接字成为非阻塞/异步?

或者非阻塞和异步之间有什么区别?

最佳答案

如果您还没有了解过,您可以在 BSD sockets 上了解非阻塞和阻塞套接字之间的区别。维基百科上的页面。

此外,您可以查看 ioctlsocket() MSDN page for a few details on FIONBIO

According to IBM :

FIOASYNC Enables a simple form of asynchronous I/O notification. This command causes the kernel to send SIGIO signal to a process or a process group when I/O is possible. Only sockets, ttys, and pseudo-ttys implement this functionality.

FIONBIO Enables nonblocking I/O. The effect is similar to setting the O_NONBLOCK flag with the fcntl subroutine. The third parameter to the ioctl subroutine for this command is a pointer to an integer that indicates whether nonblocking I/O is being enabled or disabled. A value of 0 disables non-blocking I/O.

希望这对您有所帮助。

关于c - 套接字的 FIONBIO 和 FIOASYNC 有什么区别?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7440571/

相关文章:

c - 套接字编程,绑定(bind)()错误

c++ - ASIO io_service 问题多次运行

c++ - 性能比较 - pcap 文件读取 : C+ +'s ifstream VS C' s fread

c - 服务器 "Kill"本身

c - GtkAlignment 一次只能包含一个小部件

并发访问文件 linux

objective-c - asyncsocket "connectToHost"总是成功并且永远不会返回失败

c# - 为什么 Socket.AcceptAsync 没有触发 SocketAsyncEventArgs Completed 事件?

C# 异步套接字服务器未收到来自 Java 客户端的响应