title: I am getting a different port number than I use
body: <p>I have 2 java programs, Server and Client.</p>
  
  <p>I am trying to connect the client program to the server program using java socket programming.</p>
  
  <p>Here is the Server program :</p>
  
  <pre><code>public class ServerX {
     public static void main(String[] args) {
      ServerSocket ss = new ServerSocket(987);
      Socket s = ss.accept();
      InetSocketAddress isa1 = (InetSocketAddress) s.getRemoteSocketAddress();
      System.out.println(isa1.getPort()); 
      ss.close();
    }
  }
  </code></pre>
  
  <p>And here is the Client program :</p>
  
  <pre><code>public class ClientX {
     public static void main(String[] args) {
        Socket s = new Socket("ip of the server", 987);
        s.close();
     }
  }
  </code></pre>
  
  <p>I expected that <code>isa1.getPort()</code> in the Server program gives <code>987</code>, but it actually gives <code>52532</code> instead.
  So what is the problem, and what <code>53532</code> means? </p>