Java Socket Address Get getPort(SocketAddress socketAddress)

Here you can find the source of getPort(SocketAddress socketAddress)

Description

get Port

License

Open Source License

Declaration

public static Integer getPort(SocketAddress socketAddress) 

Method Source Code


//package com.java2s;
//License from project: Open Source License 

import java.net.SocketAddress;

public class Main {
    public static Integer getPort(SocketAddress socketAddress) {
        if (socketAddress == null) {
            return 0;
        }//from  www  .  j  ava2  s. co  m
        String address = socketAddress.toString();
        return Integer.valueOf(address.substring(address.indexOf(':') + 1));
    }
}

Related

  1. getLocalAddress(Socket socket)
  2. getLocalSocketAddress(String host, int port)
  3. getNetworkVersion(InetSocketAddress address)
  4. getOffsettedAddress(InetSocketAddress isa, int offset)
  5. getPort(InetSocketAddress socket)
  6. getRandomLoopbackInetSocketAddress(final int port)
  7. getRawAddress(InetSocketAddress inetSocketAddress)
  8. getSimpleIpport(SocketAddress remoteAddr)
  9. getSocketAddress(InetSocketAddress socket)