Howdy all!
I have an application that creates and interacts with sockets and some low-level devices. I currently pass it a config file so it knows what kind of environment it runs in. What I would like to do is run one instance of this application for each device all at the same time, something like:
# program configfile1 &
# program configfile2 &
etc., so they're all running at the same time.

However whenever I do that, none of the sockets are created and it seems the program does nothing. There's no user interaction here, although it speaks to the serial port. If I wait and hit enter at the prompt, I get:

Stopped [45] program

where 45 is its pid.

I think I can do something like this in the main(...) of my application:

Code:
  if ((pid = vfork()) < 0)
   {
      perror("Error in vfork()");
      return;
   } //end if vfork error

   //child
   else if (pid == 0)
   {
      //we are the child 
      sigignore(SIGINT);                                 //ignore keyboard interrupts
      close(STDIN_FILENO);                                //close stdin
      printf("[%d]  %ld\n", numOfBackgrounds, getpid());  //print ACK


     .... put all the rest of my code here........



      } //end if

    }
   else //parent
   {
   if (!background)
         waitpid(pid, NULL, 0);   //wait for child since we're foreground
   }
and this will do what I want.

However I am still curious as to why a non-user-interactive program won't create sockets when executed in the background?
This is on RH 8.0 using the bash shell.

Thanks.
Curious.