News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

How to get local IP address under Win32 (WinXP)?

Started by RobinHE, February 26, 2007, 05:02:32 PM

Previous topic - Next topic

RobinHE

Hello, I am a total newbie to 32-bit ASM but am experienced in 16-bit ASM (under MS-DOS). I am learning using MASM32 and great sources of information such as this forum!

I would like to know how to fetch the IP address of a local network adapter (and for test purposes simply wish to convert to a string and display it). My OS is Windows XP SP2 and the IP address for the local adapter has been assigned by DHCP. Do I use an API for this? Any help would be very much appreciated, thank you.

ragdog

hi snowydog

here is a small example
i delete getip.zip

i have found a another good  example

greetz
ragdog

[attachment deleted by admin]

Tedd

gethostname to get the name of your machine, and then gethostbyname to get the ip of the given host.

Example attached (you can have more than one ip assigned, so it lists all.)


[attachment deleted by admin]
No snowflake in an avalanche feels responsible.

RobinHE

Thanks Tedd and ragdog, your examples are very helpful. Being new to Win32 ASM programming, is there a good resource (book, online etc..) you would recommend to me for getting detailed information on the various APIs ?

Tedd

Iczelion's tutorials are a pretty good start - which you can find here: http://www.movsd.com/icz.htm (they may also be included in the masm32 package - they were, not sure now.)

If you can find a good reference then that's always helpful - you can browse the different function and find out what they do - http://msdn2.microsoft.com/en-us/library/default.aspx is the obvious choice, but I prefer an offline reference (do a little searching for the win32.hlp file :wink)

And.. then there's always us :bg Post any random question and you're likely to get a useful answer (and maybe ten more.)
No snowflake in an avalanche feels responsible.