title: Send UDP packets to IP with NAT
body: <p>I have a server running a public IP with no NAT. It receives UDP packets and I want to send them to each client that's connected. </p>
  
  <p>The client or clients would behind a NAT.</p>
  
  <p>I've read about UDP hole punching but it doesn't seem like exactly what I want. I'm not trying to send from client to client. I want data flow to go from client -> server -> all clients.  </p>
  
  <p>The Client</p>
  
  <pre class="lang-java prettyprint-override"><code>// Init TCP Socket
  connection = new Socket(connectionAddress, 54540);
  
  // Create receive socket
  DatagramSocket socketReceive = new DatagramSocket(54541);
  </code></pre>
  
  <p>The Server</p>
  
  <pre class="lang-java prettyprint-override"><code>
  // Receive socket
  receiveAudioSocket = new DatagramSocket(54541);
  
  // Thread to handle new received packets
  ServerAudioReceiverWorker audioReceiverWorker = new ServerAudioReceiverWorker(receiveAudioSocket, this);
  audioReceiverWorker.start();
  
  // TCP Socket
  serverSocket = new ServerSocket(54540);
  System.out.println("Server has started");
  </code></pre>
  
  <p>This is the basic setup for my client server.</p>
  
  <p>I expected that if I send a UDP packet from the client to the server public IP. The router would add a NAT rule for port 54541 on the clients network to receive UDP packets sent from the server back to the public IP of the client and port 54541. It doesn't seem like it's working that way.</p>
  
  <p>I guess that's because the NAT rule being assigned is given a specific port for requests to the public IP to target the local IP. I'm not sure how to find the port that the server should send the packets to for each client.</p>
  
  <p>Do I need to use UPnP to open the port on the client network and let the server know which port to send packets to.</p>