Click to See Complete Forum and Search --> : IP Address VS Host Name


tonib
July 22nd, 1999, 10:31 AM
I need a function, which accept a host name and return the IP address of the same machine, and a function that performs opposite.

Are in Visual C++ such functions or have anyone an idea how to write them ?

Derek
July 22nd, 1999, 11:37 AM
Use gethostbyname and gethostbyaddr, or any of the other gethostby... functions. Both return a structure (hostent/HOSTENT) whereby you should be able to extract that information.

Dennis Jump
July 22nd, 1999, 11:39 AM
use gethostname to get the name of your local machine, too
Dennis