Jump to content
xisto Community
Sign in to follow this  
kanade

Get The Current Running Machine Ip-c/c++ Coding

Recommended Posts

There are many ways to get the current machine ip in c/c++ coding. I prefer to use gethostbyname(*hostname).But the issue with this is we need to pass hostname to get the IP address of the machine. Is there any other alternative solution to get the current machine IP without knowing the hostname?.It works fine in windows as we can pass a null pointer in place of hostname then gethostname() will return the IP.But same will not work in Linux, it will give segmentation fault.If you have any suggestion please let me know.

Share this post


Link to post
Share on other sites

Nice info, thanks. Probably a lot of people here forgot that.
However, unfortunately, I would say that this is not really a tutorial ! At leas I feel it really short. Remember or tutorial rules http://forums.xisto.com/topic/6-forum/ :

1. The Tutorials have to be of a bare minimum length of 500 words to be accepted.

That's why I moved it here, where is more probably it's place.Regards
Yordan

Share this post


Link to post
Share on other sites

Nice info, thanks. Probably a lot of people here forgot that. However, unfortunately, I would say that this is not really a tutorial ! At leas I feel it really short. Remember or tutorial rules http://forums.xisto.com/topic/6-forum/ :

That's why I moved it here, where is more probably it's place.
Regards
Yordan


OK may be i have posted in rong place, but i have not posted this one as tutorial and i know that this can't be a toturial. Just i posted this to get the info from the people here and give some info too. any ways for moving this topic to correct place.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×
×
  • Create New...

Important Information

Terms of Use | Privacy Policy | Guidelines | We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.