I am trying to implement P2P with Hole Punching. Here is the flow:
- Both Peers(P1,P2) will send 1 packet to server(S).
- Server(S) replies back to both telling others IP:PORT
- P1 and P2 receive this UDP packet knowing other's external/public ip:port.
- P1,P2 start sending packet to other peers public IP:PORT.
- Once peers receive other peer's packet, I assume the hole is punched and will give this socket to my Application.
I tested this on different routers, here is the outcome:
- When P1 and P2 both are on non-symmetric-NAT (Full/Restricted cone), I don't face any problem.
- When P1=Non-Symmetric and P2=Symmetric:
- -----router-1 (Symmetric-NAT) + router-2 (non-Symmtric) = Success
- ---- router-3 (Symmetric-NAT) + router-2 (non-Symmtric) = *Failure*
Until 4th Step its fine. But in 5th step, no peer receives the packet of other peer. I was expecting that at-least *'peer behind non-Symmetric NAT' will receive the packet of other.*
Anybody has any idea whats happening?