I have difficulties with P2P discovery in DefNet test app. I need it for establishing communication between two Defold game clients.
When I’m sending UDP message locally (f.e. with program like Packet Sender) - I’m receiving that message in DefNet app (in the same way as I’m receiving packages sent from DefNet in Packet Sender).
But when I’m trying to test DefNet app through the Internet - it’s not working. I have mikrotik router and it seems that I’ve properly set the rules for UDP 50000 port (but not completely sure).
Even if I’ll figure out the problem - how I can be sure that it will work for some other user, if it should be done manually every time?
Actually I’m not completely aware of how it’s working - should it send that message to all internet users that listening for specific port? Is it really broadcasting?
I will be grateful for any help, just let me know if you need some details from me.
It’s telling: “I could not see your service on {my IP} on port (50000)”
But I thought we can’t check UDP so easily as it shouldn’t send something back:
“It has no handshaking dialogues, and thus exposes the user’s program to any unreliability of the underlying network; There is no guarantee of delivery, ordering, or duplicate protection.” (c) wiki
I thought maybe it’s wrong to use 50000 port? Maybe I should use some other port for broadcasting? Also in app port 255.255.255.255 is hardcoded. People here Network UDP broadcast design? - Stack Overflow telling that this port “won’t be forwarded by routers”
I’m not an expert at networking so I can’t say. You could try hosting a known UDP server for a game, and then see if a friend with that game can connect to you to see if the port is setup properly too.
I think the P2P discovery features are only for local networks?
Ah, that’s a good idea. I can setup some test node.js app, send something through UDP and then try to catch it from Defold.
Good question.
What I need is some kind of negotiation to acquire real IP of players and establish TCP connection between them (without servers). If it’s possible at all.