Hey. I am trying to make a LAN Messenger and I was wondering what CountHostIPs() actually returns. Does it return everyones' IP addresses who are hosting something or does it return only your's?
I'm sorry, I was rereading what I had put down earlier and noticed that I had asked my question wrong. How would you connect to an LAN networked computer that is using the same port and same program without having the IP address of said computer? There we go. Sorry about that once more.
I'd select a high port number like 32000 (so you don't interfere with other services that normally use lower port numbers), and have the program listen for a message.
If I didn't receive a message within say 20 seconds send a message out port 32000 with the broadcast address (see code archive).
Sending a message using the broadcast IP is like sending the message to all 255 computers on your subnet.
Once the listening computer receives the message, the listening computer will have the senders IP.