Reputation: 1589
In the example of official doc,seems that we should accept connection one by one.This makes me confused,so I read the source code of sun.nio.ch.UnixAsynchronousServerSocketChannelImpl ,in the line 269 there is a comment check and set flag to prevent concurrent accepting,So could someone tell me why should prevent current accepting? Is this a OS's limit or there is no need to accept connection currently.Thanks in advance.
Upvotes: 1
Views: 126
Reputation: 310909
You are conflating concurrency with asynchronicity. When you accept a connection via async I/O you should immediately schedule another asynchronous accept()
.
Upvotes: 1