user1816090
user1816090

Reputation: 13

How I can bypass NAT/Firewall in udp connection

i am programming voice chat app but the problem is when client is using router firewall block connection

i solved this problem with tcp connection but with udp connection i didn't know how i can solve this problem

i try udp hole by this step

  1. client A send to (server) ip and username
  2. client B send to (server) ip and username
  3. (server) send to client B client A info — to start voice chat
  4. (server) send to client A client B info — to start voice chat

but this work one time and many time didn't work i dont know why. any help.

Upvotes: 3

Views: 3077

Answers (2)

micmanos
micmanos

Reputation: 31

NAT punchthrough requires an external "matchmaking" server and is possible on all BUT non-symmetric routers and firewalls. Putting it simply these "symmetric" routers change the outbound/inbound port of your data each time you change either the IP or the PORT of the destination, effectivelly nullifying the "matching" that the server is trying to do.

There are other "crafty" ways of doing a punchthrough but they lack coherence.

I would advise you to read about the differences of NAT types (Assymetric, Symmetric, Full cone, Restricted cone, Port restriceted cone). Also make sure you read about STUN which allows you to identify the type of NAT your client is operating behind. Finally, you should read about UPnP which is a feature that most routers have, and allows programs to self-register and open ports, without the user having to do that manually through the router interface.

Upvotes: 3

user739711
user739711

Reputation: 1872

What you are trying is UDP-hole punching. But few routers, which has symmetric NAT, hole-punching is very difficult and inconsistent (when possible). Read about different NATs on wikipedia, you will get more insight.

Upvotes: 3

Related Questions