in reply to Re^4: Terminal across network
in thread Terminal across network

Here's a snippet from one I wrote earlier. (A perl telnet client actually, which seems to be essentially what you want) :
my $sockets = new IO::Select(); $sockets->add(\*STDIN); my $tel = new IO::Socket::INET( PeerAddr => $hostname, PeerPort => $port, Proto => 'tcp', Timeout => 60 ); die "Can't connect to $hostname ($!)" unless $tel; $sockets->add($tel); while(1) { my @handles; @handles = $sockets->can_read(0.5); foreach $handle (@handles) { if($handle == $tel) { $data = <$tel>; last if(!$data); print STDOUT $data; } elsif ($handle == \*STDIN) { $line = <STDIN>; chomp($line); if ($line eq 'q' || $line eq 'quit') { $finish = 1; last; } else { print $tel $line."\r\n"; } } } }
I've simplified it some, you will need to probably read from the telnet socket using recv instead of <>, since this will hang when telnet sends lines without endling newline characters (which it is apt to do).

C.

Replies are listed 'Best First'.
Re^6: Terminal across network
by rockmountain (Sexton) on Oct 22, 2004 at 06:36 UTC
    Started working on the project. It seems I am looking for something like this. "http://www.broadwayinfo.com/" Any inputs are welcome.
    cheers! Rock