Help for this page

Select Code to Download


  1. or download this
    use Socket qw(AF_INET pack_sockaddr_in);
    use Net::Interface;
    
    my $intf = Net::Interface->new('eth0');
    my $ipaddr = $intf->address(AF_INET);
    
  2. or download this
    bind(SOCKET, pack_sockaddr_in(0, $ipaddr)) || die "can't bind socket t
    +o local address";