Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked

Re: TCP Client not working

by oiskuu (Hermit)
on Oct 27, 2013 at 17:45 UTC ( #1059927=note: print w/replies, xml ) Need Help??

in reply to TCP Client not working

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).

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)
To pass window size/ttype/etc., the Net::Telnet interface might be chosen. You've essentially reimplemented the telnetd.

OTOH, if you simply want to avoid signals from the child interrupting the server process, the following might be of use:

use POSIX; my $pid = fork(); if ( $pid == 0 ) { setsid(); close STDIN; close STDOUT; close STDERR; RunCommand( ... ); }
Child setsid() detaches it from the controlling tty.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1059927]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others imbibing at the Monastery: (3)
As of 2016-10-27 04:42 GMT
Find Nodes?
    Voting Booth?
    How many different varieties (color, size, etc) of socks do you have in your sock drawer?

    Results (353 votes). Check out past polls.