Help for this page

Select Code to Download


  1. or download this
    use IO::Socket::INET;
    my $socket = IO::Socket::INET->new("${my_server}:${my_port}") or die $
    +!;
    print $socket "My Ping\n";
    my $answer = <$socket>; #should be 'My Pong'
    close $socket;
    
  2. or download this
    use IO::Socket::INET;
    my $server = IO::Socket::INET->new(LocalPort=>$my_port,Type=>SOCK_STRE
    +AM,Listen=>1) or die $!;
    ...
        my $message = <$client>;
        print $client "My Pong\n" if ($message =~/My Ping/);
    }