I wrote a program which create a tcp server socket, call the accept function,
and every-time it returns without error, I fork.
The child process close the server socket and handle the new one.
The main process close the new one, and loop calling the accept function again.
The main process traps and treats the SIGCHLD signal to free every child finishing.
This program works if all tcp connection requests come from the local machine.
In some cases, when tcp connection requests come from outside local-host, and when many requests come in the same time:
1- accept function does not returns,
2- Clients see their socket established, their write done, and loop in waiting responses
The problem disappears:
1- if clients delay their requests,
2- if I introduce a sleep of 0,1 second in my loop before calling the accept function again.
3- If we are working on slow machines.
Somebody has an idea to help?
Is there any parameter to be adjust?
[Prev in Thread]
[Next in Thread]
TCP Socket's accept function does not return,