Java Socket Port getMyPortNumber(ServerSocket serverSocket)

Here you can find the source of getMyPortNumber(ServerSocket serverSocket)

Description

get My Port Number

License

Creative Commons License

Declaration

public static int getMyPortNumber(ServerSocket serverSocket) 

Method Source Code

//package com.java2s;
/*/*from   w ww  .j a va2s .  c  o  m*/
 * This work is licensed under a Creative Commons Attribution-NonCommercial-NoDerivatives 4.0
 * International License (http://creativecommons.org/licenses/by-nc-nd/4.0/).
 */

import java.net.ServerSocket;

public class Main {
    public static int getMyPortNumber(ServerSocket serverSocket) {
        return serverSocket.getLocalPort();
    }
}

Related

  1. getFreeSocketPort()
  2. getHostPort(Socket s)
  3. getPort(ServerSocket server)
  4. getRandomPortServerSocket()
  5. getServerSocket(int i_Port)
  6. isValidSocket(String host, int port)