difficulty in getting the ip address by copmuter name

i'm working on a mini massanger using SFML library, in which i'm trying to get the IP address of client by his name using the SFML library function as following.

sf::IpAddress ip("CLIENT-PC");

sometimes it works, and sometime not, whether the client is available on the LAN.
please, reply soon.
Last edited on
If your computer isn't connected to the network, and it's relying on the network to assign it an address (using DHCP), then it won't have an address.

You can view the network interface config from the command line. On Windows it's ipconfig on Unix/Linux you can try ifconfig or ip addr

Your program is getting the same information as what's displayed with these.
Last edited on
Topic archived. No new replies allowed.