Help for this page

Select Code to Download


  1. or download this
        my $sock = new IO::Socket::INET( PeerAddr => '127.0.0.1',
                                         PeerPort => 12000,
    ...
                                         Blocking => 1);
    
        print $sock "Hello\n";
    
  2. or download this
        my $server = IO::Socket::INET->new( LocalPort => 12000,
                                            Proto     => 'tcp',
    ...
            print "Connected to sock\n";
            print while <$sock>;
        }
    
  3. or download this
    use strict;
    use warnings;
    ...
        print "sock is $sock\n";
    
    }
    
  4. or download this
    $ perl SocketT.pl 1  (to launch as a server)
    $ telnet localhost 12000 (in another window, to tie up the server)
    $ perl SocketT.pl 2  (to test if it would connect and print out)