Help for this page

Select Code to Download


  1. or download this
    my $protocol = getprotobyname('tcp');
    socket(SOCK, AF_INET, SOCK_STREAM, $protocol) or die "No socket: $!";
    ...
    }
    
    close SOCK;
    
  2. or download this
    my $socket = IO::Socket::INET->new(    Listen        => 20,
                        LocalPort    => $port,
    ...
        warn "Connection from [$peer,$port] finished\n";
        close $session;
    }
    
  3. or download this
    my $socket = IO::Socket::INET->new("$host:$port") or die "No connect: 
    +$!";
    
    ...
        $bytes{'out'} += length($msg_out);
        $bytes{'in'} += length($msg_in);
    }