dhable has asked for the wisdom of the Perl Monks concerning the following question:

I found the prior discussion about obtaining an IP address, but I have some additional problems.

I'm writing a simple client to trigger a SOAP server module and would like to keep the IP Address so I can do some run time events based upon the region the user is in. I can''t run ipconfig and grab the IP address since the Win95 boxes don't come with ipconfig. Is there any other way I can capture the IP address that's fast. (I would hate to slow down those speed demon Win95 boxes :O)

Thanks, Dan

Replies are listed 'Best First'.
(tye)Re: IP Address On Old Systems
by tye (Sage) on Jan 15, 2002 at 02:16 UTC

    Sounds like you want the server to be able to fetch the IP address of the client. That is what getpeername is for.

            - tye (but my friends call me "Tye")
Re: IP Address On Old Systems
by nikos (Scribe) on Jan 15, 2002 at 02:27 UTC
    You can try to use something like 'route print'. And get the result of the command. There is your IP Address there.
    C:\Documents and Settings\Administrator>route print ====================================================================== +===== Interface List 0x1 ........................... MS TCP Loopback interface 0x10003 ...00 10 a4 11 4d 60 ...... Intel(R) PRO/100+ MiniPCI ====================================================================== +===== ====================================================================== +===== Active Routes: Network Destination Netmask Gateway Interface M +etric + 30 + 1 + 30 + 30 + 30 + 30 + 1 Default Gateway: ====================================================================== +===== Persistent Routes: None C:\Documents and Settings\Administrator> is my IP Address where the netmask is and the gateway is try to parse the output of this command
Re: IP Address On Old Systems
by Albannach (Monsignor) on Jan 15, 2002 at 09:40 UTC
    Since you're talking about ipconfig.exe you may be interested that for Win95 boxes, the approximate equivalent is called winipcfg.exe, and while it normally pops up a dialog box, you can force it to write to a file by using its batch mode: winipcfg /batch ip.dat (and if you don't specify a file it will write to winipcfg.out).

    I'd like to be able to assign to an luser