0

I want to create a web server that listens to 3 TCP connections and reads data from each one of them. I'm making those connections through a for loop.

My understanding is that there would be three different epoll instances, one for each connection. Does this mean there are three threads blocked listening to three separate epoll instances? How would this work? I'm not sure how the kernel reads three epoll instances and returns a flag when one of them receives data.

Shepmaster
  • 388,571
  • 95
  • 1,107
  • 1,366
pandawithcat
  • 571
  • 2
  • 13
  • Why do you think there would be three different epolls going on? Isn't the whole point of event loops (reactors) like mio that you have *one* epoll() performed by mio, and that you use the mio API to tell it what you're interested in. – user4815162342 Nov 09 '20 at 17:20
  • right that was my guess too but while reading the mio source code, I couldn't find the epoll_ctl() nor the shared epoll instance so i was wondering if I missed something or not – pandawithcat Nov 09 '20 at 17:33
  • The github search reveals [this](https://github.com/tokio-rs/mio/blob/152e0751f0be1c9b0cbd6778645b76bcb0eba93c/src/sys/unix/selector/epoll.rs#L87) for `epoll_ctl`, and the shared epoll instance is simply the `Selector` that's being implemented. – user4815162342 Nov 09 '20 at 18:28

0 Answers0