I have a client tcp socket (in c++) that has a loop where it retries to open a socket and connect to a server at a certain interval until it succeeds.
A bug in the program caused close
not to be called on the file descriptor after a failed connect, and the same (open) descriptor was used again when calling socket
and connect
in the next iteration of the loop when retrying to reconnect.
On Linux machines this did not cause any problems, while on HPUX it eventually cause a error 24 - Too many open files - lsof showed these as TCP *:* (IDLE)
.
What is the difference here between Linux and HPUX?