I know that a server normally open one port and listen it.
Today I learnt that there was a function
select helps with handling reads and writes on multiple sockets. It doesn't have to be multiple server sockets. The most typical use is for multiplexing a large number of client sockets.
You have a server with one listening socket. Each time you
accept a connection, you add the new client socket to the multiplexing pool.
select then returns any time any of those sockets has data available to read. The big win is that you're doing all this with one thread.