Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

IP Address On Old Systems

by dhable (Monk)
on Jan 15, 2002 at 01:15 UTC ( #138709=perlquestion: print w/replies, xml ) Need Help??

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 0.0.0.0 0.0.0.0 192.168.55.1 192.168.55.13 + 30 127.0.0.0 255.0.0.0 127.0.0.1 127.0.0.1 + 1 192.168.55.0 255.255.255.0 192.168.55.13 192.168.55.13 + 30 192.168.55.13 255.255.255.255 127.0.0.1 127.0.0.1 + 30 192.168.55.255 255.255.255.255 192.168.55.13 192.168.55.13 + 30 224.0.0.0 240.0.0.0 192.168.55.13 192.168.55.13 + 30 255.255.255.255 255.255.255.255 192.168.55.13 192.168.55.13 + 1 Default Gateway: 192.168.55.1 ====================================================================== +===== Persistent Routes: None C:\Documents and Settings\Administrator>
    192.168.55.13 is my IP Address where the netmask is 255.255.255.255 and the gateway is 127.0.0.1.... 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

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://138709]
Approved by root
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others imbibing at the Monastery: (8)
As of 2022-05-25 14:20 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Do you prefer to work remotely?



    Results (90 votes). Check out past polls.

    Notices?