![]() |
|
#1
|
|||
|
|||
get the local host ip in unix osDear's
how r u ? i am using unix os. already i wrote one small code to get the local ip address, but it display the unix server ip address. so, how can i get my local pc ip addressin c++ program. please give me the code to get the ip(only unix os). |
|
#2
|
|||
|
|||
Re: get the local host ip in unix osQuote:
There are no standard C (or C++) library functions that deal with issues of network interfaces or ip addresses or any other hardware-dependent system properties. One function that is commonly available is getifaddrs(). Check to see if your system has it. There may or may not be a man page for it. If not, then you can look for information on the web. Note that this gets a list of structs that contain, among other things, ip addresses for all interfaces (including localhost), so you may have to do a little work to dig out the pertinent information. Also, note that the versions that I have used only worked for IPv4, and I haven't followed recent developments to see what has been done for IPv6, so if you require complete information for IPv6 you might have to try something else. Also note that I don't have any UNIX systems to allow me to verify anything you might come up with or to answer any specific questions. It is likely that other people might have such systems, but to expect meaningful responses, you might consider telling exactly what UNIX system you are using (and what compiler, since some systems have very crippled compilers, and some have complete gcc or other installations). These things (library functions, etc.) are system-dependent. Regards, Dave |
|
#3
|
|||
|
|||
Re: get the local host ip in unix oshi,
thx ur reply. i am using Sun Solaris 10. compiler is CC only. not accept the g++ or gcc. |
Recent GIDBlog
More photos on Flickr by crystalattice
| Thread Tools | Search this Thread |
| Rate This Thread | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Looking for a free host with phpBB support | Riamus | Free Web Hosting | 6 | 22-Oct-2006 18:30 |
| Host Color: Host Up To 10 Web Sites And Get Your Free .EU , .Ca or .Us Domain Name | fcolor | Web Hosting Advertisements & Offers | 0 | 12-Jun-2006 07:43 |
| Host Unlimited Sites $19/year. Hot Hot Hot!!! | nethostspace | Web Hosting Advertisements & Offers | 1 | 12-Jan-2006 19:20 |
| access local webserver from the local host | calisro | Apache Web Server Forum | 1 | 10-May-2004 08:53 |
| Before posting a web host review - PLEASE READ | JdS | Web Host Review Forum | 0 | 16-Oct-2003 09:28 |
Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The