This example assumes one is using UDP.
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.
Does that help, or do you need actual code ?
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.
Does that help, or do you need actual code ?