avoid sending udp packages to yourself |
avoid sending udp packages to yourself |
MrOzBarry
|
I'd recommend sending either a uuid or a combination of a small hash and message id/timestamp. Uuid would be nice to identify clients, but a small hash and message id can do the same job.
But also be aware that if you are having multiple clients broadcasting frequently, it might be a sign off a strange/bad design, depending on what you're trying to do. On that not, what are you trying to achieve? |
|||||||||||
|
avoid sending udp packages to yourself |
MrOzBarry
|
Sorry my new email so cut off some of your message my initial read.
Probably what you should do is assign a uuid to the payer hosting the game, which would become the 'game id.'. The server broadcasts this every few seconds, which in turn advertises the IP, and your want to send the game port if it's unknown, as well as some type of game identifier so other applications that may be listening for similar broadcasts can ignore it. This is the type of strict I'd use for broadcasting: struct GameBroadcastPacket {  char identity[3]; // Small abbreviation of your game name  long port;  char game_id[32]; // probably could be shorter, but guid v4 is 128bit/32 bytes long }; When a client receives this, they can trace the host IP from the packet, and the host can ignore any broadcast with its own have id. On Mon, 12 Jan 2015 5:21 am Meldryt wrote:
|
|||||||||||||
|
Meldryt
|
Thanks, i know how to do handle with incoming packages. I think i found what i want. I just have to bind all the ipaddresses that i want to broadcast to, to a channel.
|
|||||||||||
|