I am trying to write a Linux Daemon that will accept TCP/IP connections on a specific port. During development I did not have the code in that creates a child process and then exits the parent and everything worked fine. I was able to run a test for 24 hours without a problem.
However, after putting the code at the beginning that initiates a child process, then exits the Parent the Accept function started to fail. Below is my accept function.
The question is why does the accept return a value less than zero when it is running as a Daemon? In other words this code is in the child process that continues running when the main process has exited. If I remove the code that starts the Child Process and exits the parent, the accept works just fine. How can I make it work properly under the Child Process?
I have attached the CPP file that contains the code.
* The Best Reasons to Target Windows 8
Learn some of the best reasons why you should seriously consider bringing your Android mobile development expertise to bear on the Windows 8 platform.