gpt4 book ai didi

java - 当 OP_ACCEPT 事件发生时,解复用器是如何被通知的

转载 作者:太空宇宙 更新时间:2023-11-04 10:33:59 24 4
gpt4 key购买 nike

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/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com