Reputation: 17615
In my own experience,I bind 1 socket and dispatch the requests to other threads.
But the famous web server nginx is bind()
multiple sockets on the destination port.
What's the benefit to do it this way?
Upvotes: 2
Views: 363
Reputation: 2667
Looking through nginx source, I don't see that possibility. To quote from the man page ip(7)
When a process wants to receive new incoming packets or connections, it should bind a socket to a local interface address using bind(2). Only one IP socket may be bound to any given local (address, port) pair.
So, I think that there is something else going on. Can you mention how you determined that nginx was doing this?
Upvotes: 1