Hi,
Thank you very much for your message. I'm using perl 5.005_03 on HP-UX 10.20 and 5.8.0 on Tru64 v5.
I think that i've not explained the exact problem.
The connection sequence would be as shown:
-
client uses telnet to make connection to inetd port (eg 9876)
-
inetd spawns my perl process and disassociates itself from the active socket created. My perl process does not explicitly open a socket; all it's doing is writing to stdout, which in turn will be written on the socket back to the client.
-
My perl process runs remsh and writes whatever data is returned by remsh.
At this point, I close the client that calls the telnet. If I start remsh w/o the -n option, then the spawned child remsh process becomes defunct (most probably b'cos the parent remsh process does not do a wait()). If I start remsh with the -n option, then there does not appear to be any signals processed (additionally remsh inherently ignores TERM, INT and QUIT).
So, at this point, I have my perl script still running along with the remsh processes. The script will exit along with the remsh processes only when there is some data returned from remsh and SIGPIPE is received.
Is there any other way I can check for the closure of the socket from my perl script (given the fact that I dont have a file handle on the socket) ? Also, any other way I can check for the closure of STDOUT ? I cant write arbitrary data out to STDOUT as the script writes to another set of processes that parse the data and expect the data to be in a certain format and those processes cannot be modified easily.
Thanks again!