title: Opening a port on Ubuntu 14.04 for communicating remotely with `DatagramSocket` client and Server
body: <p>I have two hosts one with Ubuntu 14.04 acting as server and other with windows 10 acting as client.Code in client side is as follows.</p>
  
  <pre><code>DatagramSocket socket = new DatagramSocket();
  InetAddress destination = InetAddress.getByName("192.168.0.120");
  DatagramPacket packet = new DatagramPacket(buffer,buffer.length,destination,50005);
  socket.send(packet);
  </code></pre>
  
  <p>At server side:</p>
  
  <pre><code>DatagramSocket s = new DatagramSocket(50005);
  DatagramPacket p = new DatagramPacket(receivedata,receivedata.length);
  s.receive(p);
  </code></pre>
  
  <p>They both work fine under private network that is server is listening on port 50005 within private network.But replacing private address with public and accessing server isn't working.It's because port "50005" is closed.</p>
  
  <p>How to port forward "50005" to my Ubuntu desktop where java server resides and make it accessible from anywhere on internet?</p>