#!/usr/bin/perl use warnings; use IO::Socket; $server = IO::Socket::INET->new ( LocalPort => 1337, Type => SOCK_STREAM, Reuse => 1, Listen => 5 ) or die "could not open port\n"; warn "server ready waiting for connections..... \n"; while ($client = $server->accept()) { unless (defined($child_pid = fork())) {die "can not fork\n"}; if ($child_pid) { warn "client connected\n"; while($line = <$client>){ print $line; } }else{ while($line = <>) { print $client $line; } } }
In reply to writing to telnet? by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |