I'm communicating between two processes in tcl using Tcl-DP.
I create a server using dp_MakeRPCServer
on one processs and a client on the other process using dp_MakeRPCClient
.
When the client is created it connect to the server and a new socket is created between both processes.
First process
dp_MakeRPCServer 50000
file channel
> stdin stdout stderr tcp0
Second process
dp_MakeRPCClient <host> 50000
file channel
> stdin stdout stderr tcp0
First process
file channel
> stdin tcp2 stdout stderr tcp0
We can see that tcp2
on the first process is the socket.
Now I'm doing fork and the channels are cloned into the child.
child process (forked from first process)
file channel
stdin tcp2 stdout stderr tcp0
I want to close tcp2
(the socket) on the child without closing the socket between first and second processes.
close tcp2
will just close the socket, in the child, in the first process and in the second process.
I will also accept any other suggestion to do it which consider:
- At any time other processes may try to connect to the server of the first process. I don't want the child process to receive those calls.
- At any time the second process may start sending messages to the first process. Again, I don't want the child process to receive those messages.
I should mention that I'm using TclDp 4.0 and tcl 8.4.