passing of TCP-connection to a child process possible?

passing of TCP-connection to a child process possible?

Post by Gien » Sat, 30 Apr 1994 03:21:32



Is it possible to pass a TCP-Connection to a child process if it shares
the fathers' data segment?

I have a rather simple job, which could be done parallel to
the main routine, so I just want to fork a child process, which calles
a function to do the job and then exits.

for example:

   int s;

   s = socket ( AF_INET, SOCK_STREAM, 0 );
   connect ( s, addr, 0 );

   switch ( pid = fork() ) {

      case 0:  do_io_on_socket ( s );
               exit(1);
               break;

      default:  do_something_else();

   }

Will this work?

Thanks for any suggestions.


 
 
 

1. Trace back from a TCP-connection to initiating process possible ?

For doing a 'per-user'-accounting of TCP/IP-connections passing our
gateway to 'the world' I need to trace back from detected connections to
the processes which initiated them.
The only known and tried way was to read the 'protocol-control-blocks'
of the current connections from kernel and extract the socket via the
socket-pointer in this structure. The receive/send-queues of the socket
contain a process-pointer which allows access to a 'process-table'-entry
with all needed information (UID,SUID,PID...).
This works fine at telnet- and X-connections, but doesn't work at ftp and
other types of tcp-connections (why not ?).
So there has to be a better way, does anybody know one ???
Any hints are wellcome :-)

2. pppd problem

3. How to pass a TCP connection to other process

4. modem problems

5. smail failed to reap child process: No child processes

6. hexbin decoding/viewing

7. Getting a child and child's child process-id

8. printing from Win95 to linux printer

9. how to kill a child process that runs other children processes

10. Getting a child and child's child process-id

11. 4.2 inetd passes its last open descriptor to child processes

12. shell script does not pass on SIGTERM to child process

13. Passing var. to child processes