How to get ip from computer name?
-
Hi All, I am using gethostbyname function to get ip from name. It works fine if ip is defined. But if 'Obtain ip address automatically' settings is on, this function gives some different ip. Any help please. Thanks
-
Hi All, I am using gethostbyname function to get ip from name. It works fine if ip is defined. But if 'Obtain ip address automatically' settings is on, this function gives some different ip. Any help please. Thanks
manish rastogi wrote:
using gethostbyname function to get ip from name
The IP of what computer - your computer? A remote computer?
manish rastogi wrote:
if 'Obtain ip address automatically' settings is on, this function gives some different ip
Where is 'Obtain ip address automatically' set - on your computer? And 'different ip' for what - your computer, a remote computer?
-
Hi All, I am using gethostbyname function to get ip from name. It works fine if ip is defined. But if 'Obtain ip address automatically' settings is on, this function gives some different ip. Any help please. Thanks
manish rastogi wrote:
But if 'Obtain ip address automatically' settings is on, this function gives some different ip.
Which is the whole essence of DHCP. The
gethostbyname()
function does not care how your computer obtained its IP address."Love people and use things, not love things and use people." - Unknown
"The brick walls are there for a reason...to stop the people who don't want it badly enough." - Randy Pausch
-
manish rastogi wrote:
using gethostbyname function to get ip from name
The IP of what computer - your computer? A remote computer?
manish rastogi wrote:
if 'Obtain ip address automatically' settings is on, this function gives some different ip
Where is 'Obtain ip address automatically' set - on your computer? And 'different ip' for what - your computer, a remote computer?
'Obtain ip address automatically' set - on remote computer, got different ip. 'Prefered DSN Server' settings had wrong value. After changing it got correct ip.