demultiplexer 可以用这个方法监控很多 socket fds 事件:
int select (int n, fd_set *readfds, fd_set *writefds, fd_set *exceptfds, struct timeval *timeout);
从参数上看,有读事件、写事件和异常事件,但是accept事件在哪里呢?
最佳答案
这是 ServerSocket 上的读取事件。 select(2)
的手册页:
In order to be notified of incoming connections on a socket, you can use select(2) or poll(2). A readable event will be delivered when a new connection is attempted and you may then call accept() to get a socket for that connection.
关于java - 当 OP_ACCEPT 事件发生时,解复用器是如何被通知的,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38407441/