I have written a small Proxy server which listens on the port 25 and does some set of operations.
In case of secure SMTP, i fork a process and let the child process take over for this session.
The thought process was that this child process should be the one who caters to a particular clients requests. If there is another client sending mails (secured) , then i need to fork another process.
But whats happening is that once the child process has processed the clients requests, it keeps on listening, but does not cater to this client. The parent process is already listening on this socket, so forks a new process every time.
How can i handle this situation? if a process has been forked for a client(ip address), then new forking should not happen. The existing child process should handle these requests.
The program is C based and running on linux.