C# UDP punchthrough without rendevous server
<p>I am writing a program that requires two clients (peer-to-peer) to connect to each other without the use of any server whatsoever, even just in the matchmaking process. Both clients already know each others' public and private IPs. One or both clients may be behind a NAT. I cannot rely on IPv6.</p>

<p>The problem I am running into is that one client (let's call them A) must send the packet to the other (B) that punches a hole in A's NAT and passes though B's NAT which has already been punched. However, this requires that A knows the external port on B's NAT that B has punched through to, as B's local port behind the NAT cannot be used. In addition, B cannot discern this port from behind its NAT.
<a href="https://i.stack.imgur.com/kvgEx.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/kvgEx.png" alt="Visual representation of my problem"></a>
Is there any way to discern this port, or even just let B tell the NAT what port to use?</p>

<p>Thanks in advance.</p>

<p>P.S. I am using the version of .NET Unity uses, approximately 2.0.</p>

<p>P.P.S. If you have a solution that works with TCP, I'll take that too!</p>

<p>P.P.P.S. Or pretty much any protocol other than Http!</p>