in reply to Windows Networking

I'm not sure that reinstalling anything or hacking around in the registry on an otherwise perfectly functioning system is the answer. I think the right approach would be fixing the getprotobyname function to work on windows.

Replies are listed 'Best First'.
Re^2: Windows Networking
by gellyfish (Monsignor) on Aug 10, 2004 at 12:51 UTC

    It's nothing to do with gethostbyname() not working on Windows, there IS an important file missing from your system - you will get the same behaviour on Unix:

    [root@orpheus jonathan]# perl -e 'use Net::Ping; $p = Net::Ping->new() +;' [root@orpheus jonathan]# mv /etc/protocols /etc/protocols.bak [root@orpheus jonathan]# perl -e 'use Net::Ping; $p = Net::Ping->new() +;' Can't get tcp protocol by name at -e line 1 [root@orpheus jonathan]#
    If you want to test this then create a file called 'protocols' int %WINDIR%\System32\Drivers\etc and put:
    tcp 6 TCP
    In it and try your code again.

    Something else has messed your system up and it is not Perl's fault

    /J\

      gellyfish, my network is working fine. Windows does not have a file called protocols in %WINDIR%\system32\drivers\etc\. There is one called protocol which hasn't been touched since 1999, is identical on the many systems we have here & looks like this
      # Copyright (c) 1993-1999 Microsoft Corp. # # This file contains the Internet protocols as defined by RFC 1700 # (Assigned Numbers). # # Format: # # <protocol name> <assigned number> [aliases...] [#<comment>] ip 0 IP # Internet protocol icmp 1 ICMP # Internet control message protocol ggp 3 GGP # Gateway-gateway protocol tcp 6 TCP # Transmission control protocol egp 8 EGP # Exterior gateway protocol pup 12 PUP # PARC universal packet protocol udp 17 UDP # User datagram protocol hmp 20 HMP # Host monitoring protocol xns-idp 22 XNS-IDP # Xerox NS IDP rdp 27 RDP # "reliable datagram" protocol rvd 66 RVD # MIT remote virtual disk

        C:\Documents and Settings\jstowe-admin>move %windir%\system32\drivers\ +etc\protocol . C:\Documents and Settings\jstowe-admin>perl -MNet::Ping -e"my $f =Net: +:Ping->new()" Can't udp protocol by name at -e line 1 C:\Documents and Settings\jstowe-admin>move protocol %windir%\system32 +\drivers\etc\protocol C:\Documents and Settings\jstowe-admin>perl -MNet::Ping -e"my $f =Net: +:Ping->new()"
        Bearing in mind that the version of Net::Ping I have has udp echo rather than tcp as the default 'ping'. The network continues to work perfectly well with the protocol file removed.

        /J\