when i issue a gethostname() call it does not return my hostname. Instead it returns "zstation" which is the computers name in the network neighbourhood. It does not resolve either. what do i do now? i need to find the IP of the interface connected to internet somehow. be it dialup or ethernet.
Posted on 2001-03-06 21:46:00 by Zynaps
In these situations I always think 'what would I call it?' to myself and type that into the MSDN site..... and sure enough:- GetComputerName is what you want, it takes two parameters an address of a buffer, and the length of that buffer. it's in Kernel32.inc umbongo
Posted on 2001-03-07 04:54:00 by umbongo
but i don't want my computer name, i want my hostname, h142n1fls2o801.telia.com, so that i can get my current IP (as seen in winipcfg) :) This message was edited by Zynaps, on 3/7/2001 9:01:06 AM
Posted on 2001-03-07 09:00:00 by Zynaps
Hmmm.. when I use gethostbyname it gives me my computer name and I can use that to get my IP address. GetComputerName does the same thing, and I can use that to get my IP address. So it's the same thing isn't it? Give it a try, it should work :-) umbongo p.s. I got the Parameters wrong, the second parameter is the address of the length, before the call, and after the call it changes the length to that of the returned string.
Posted on 2001-03-07 10:22:00 by umbongo
Nothing was wrong, i mis-read something in thi API reference :/
Posted on 2001-03-08 12:39:00 by Zynaps