Retrieving current PC IP Address? Please help...
Hello. I am creating a basic two-person instant messenger-like application, and I need some help. If I use the "gethostbyname()" function, how would I get the user's IP address? I know there is a member of the "hostent" structure called "h_addr_list". How would I use that member to copy the IP address into a string?
Code I have myself:
Code:
char host[201]; // Hostname string
gethostname(host, 200); // Get current hostname
hostent *h = gethostbyname(host); // Function to get host information
// What to do with the "hostent *h" object?
// ...............
Thanks in advance. :)