[C/C++]-Networking-How to find the server on this network
Hey, I have a piece of software that has a server and a client version. It is designed to work on a network set up for like a home or school. something with the 192.168.whatever.whatever. Well.... I need to write the code that would allow for the client to find the server. Here's the catch. I can't hardcode the server's ip into the client and I can't tell it to the client. I need the client to broadcast a general 'hello.......?' message to find the server. How would I do this? I was thinking that I would send a packet to the ip 192.168.1.255 since the ip range is only from 192.168.1.1-254(i'm pretty sure).
Any helpful Ideas?
oh, how would I find out the source ip from a packet?I have the client listening for a response to it's 'ping' and i need to know how to get the ip of the sender of the response so that this ip can be used at the server's ip.
Thanks!
|