If your intent is to start an interactive shell on the server, then you'll probably want to spawn it with a TTY (using IO::Pty).
To pass window size/ttype/etc., the Net::Telnet interface might be chosen. You've essentially reimplemented the telnetd.my $pty = new IO::Pty; $pty->set_raw(); my $pid = fork // die; unless ($pid) { $pty->make_slave_controlling_terminal(); close STDIN; open STDIN, "+>&", $pty->slave; # ditto for STDOUT, ...; close $pty->slave; exit !exec @the_program; } close $pty->slave; event_loop_passing_data_between($pty, $socket)
OTOH, if you simply want to avoid signals from the child interrupting the server process, the following might be of use:
Child setsid() detaches it from the controlling tty.use POSIX; my $pid = fork(); if ( $pid == 0 ) { setsid(); close STDIN; close STDOUT; close STDERR; RunCommand( ... ); }
In reply to Re: TCP Client not working
by oiskuu
in thread TCP Client not working
by Rahul Gupta
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |