似乎这两个选项都可以用来使套接字成为非阻塞/异步?
或者非阻塞和异步之间有什么区别?
最佳答案
如果您还没有了解过,您可以在 BSD sockets 上了解非阻塞和阻塞套接字之间的区别。维基百科上的页面。
此外,您可以查看 ioctlsocket() MSDN page for a few details on FIONBIO 。
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/