using linux BSD socket, what happens if the number of active connection
overflows the system limit? will accept call return error?
and even if the system can accept indefinite socket connection,
can it be more than the size of integer max value?
a socket descriptor is a 4-byte integer value.
is it fair to say it is theoratically impossible to maintain more than
4294967295 active TCP connection with single process in 32bit system?
(assuming that hardware and OS can support this. and service quality does not matter.
we simply want to maintain active TCP connection)
it may be a stupid question but I am curious.
Since file descriptors are ints then you obviously can’t go above 4G file descriptors. This is true even on 64-bit systems because sizeof(int) is still 4. In theory you could open more file descriptors across multiple processes. Even if you increase all the /proc limits you’re likely to run out of kernel memory first.
Per-socket allocations in the linux kernel are in the kilobyte range so even on big servers (with many GB of ram) the maximum connection count is measured in millions, not billions.