[Techtalk] accessing a client socket handle after an exec in perl (hmh)
tech-talk at htpad.com
Sat Aug 4 14:42:27 UTC 2007
I'm still programming my first multi player game. I'm currently building the web server for clients to connect to. I successfully built the web server and had it
running. I also successfully built a daemon and had it up and running. the daemon was restarting itself and everything. it was all going great until I
put the two together. well, skipping all of that...and how I got in trouble with my host provider...now I'm separating the code for the parent, read, and
write processes with the exec command in perl and I'm having problems.
I wanted to use separate code for each process so the daemon code would not be in the code for the read and write processes.
while ($HTPad_client = $HTPad_server->accept())
forks a read process
forks a write process
loads the new read process code with the exec command
loads the new write process code with the exec command
the problem is that when the new code for the read and write processes are loaded by the exec command, the $HTPad_client handle does not work.
I tried passing the client handle like this but it did not work:
$ARGV = $HTPad_client;
$ARGV = $clientWritePID;
the new code for the process loads great but I cannot access the handle to read and write to the client.
I tried capturing the handle in the new code like this:
my $HTPad_client = shift;
my $clientWritePID = shift;
the $clientWritePID came through just fine so I know I can pass variables but the $HTPad_client handle was not usable.
I'm in desperate need of some help. If anyone knows how I can access the handle created by the parent after a client comes through please let me know. that
is, access the handle after the exec command has been called and the new code has been loaded. this new code does not seem to be able to use the handle.
Thanks, Mr. Sal Hardy
Read one man's journey:
More information about the Techtalk