Help for this page

Select Code to Download


  1. or download this
    use strict;  
    use IO::Socket;
    ...
        die "sysread: $!" if (!defined($length));
        # $buffer contains the received packet
      }
    
  2. or download this
    use strict;
    use IO::Socket;
    ...
      or die "socket: $!";
    
    syswrite($socket, "Hello, there\n");
    
  3. or download this
    my $length;
    while (defined($length=sysread($socket, my $buffer, 65536)) && $length
    + != 0)
      { ... }
    die "sysread: $!" if (!defined($length));