in reply to IO:Socket question... sort of :)
#!/usr/bin/perl use strict; use warnings; use IO::Socket; my $sock = IO::Socket::INET -> new (LocalAddr => "localhost:5000", Listen => 5) or die $!; while (my $child = $sock -> accept ()) { my $line = <$child>; print $child "You send: $line"; close $child; } __END__
Start it, and from another window:
$ telnet localhost 5000 Trying 127.0.0.1... Connected to localhost. Escape character is '^]'. Hello! You send: Hello! Connection closed by foreign host. $
Abigail
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: IO:Socket question... sort of :)
by castaway (Parson) on Aug 25, 2003 at 11:23 UTC |