Re: several TCP sockets
think of it this way.
The queue length on the TCP stack is constant, having more ports isn't going to mean you can accept more waiting connections. (e.g. there isn't a separate queue for each port, nor each socket). so you gain no benefit on this.
when you say efficiency, efficiency of what?
a single process could listen on hundreds of ports,
this is not efficient use of ports,
and since one one program can listen on a given port at any given time, it might lead you into trouble.
if for example you listen on ports 50 - 150, then you can't run a web server on the machine alongside your existing application as you're already using port 80. either the web server won't be able to bind to the port because your program started first, or your program won't be able to bind to the port because the web server is already using it.
it won't really make a difference to the CPU or memory load though.
if you assign a single socket to each port, you've got 100 open sockets,
if you use 1 port and assign 100 sockets to the port, you've got 100 open sockets.
I didn’t fight my way to the top of the food chain to be a vegetarian…
Im sick of people saying 'dont waste paper'. If trees wanted to live, they'd all carry guns.
"The inherent vice of capitalism is the unequal sharing of blessings; The inherent vice of socialism is the equal sharing of miseries."