What's the most clever way to do it?

U

Ulrich6

Guest
Hello everyone.

I have multiple machines broadcasting packets through UDP to each other on my LAN.

I want each machine to be able to read the packets the other clients send, but ignore the ones sent by itself.

What's the most clever way to do this? The only way that comes to my mind is check the server's IP at the beginning and then check the IP of the machine that sent the packets, but this is a terrible approach (there isn't even an easy way of checking the local IP in GameMaker, only impromptu workarounds).

Thank you very much in advance.
 

FrostyCat

Member
Make each client generate four random 32-bit integers as its unique signature, then write them onto the broadcasts. Whenever you get a broadcast, read the four s32's back and discard it if it matches the stored signature.

Also, stop dreaming about "an easy way to find your own local IP", chances are you don't have a unique one. These days, most systems have at least 3 different IP addresses that can all be considered their own local when active. There would be one for your wireless NIC, another for Ethernet, and a couple more if you have things like VirtualBox/Parallels, VPN or Hamachi installed.
 
U

Ulrich6

Guest
Thank you very much FrostyCat. You suggested a great approach.
Yes, I wasn't inclined to looking for the local IP at all, as I said.
 
Top