Java Socket Address Get getSimpleIpport(SocketAddress remoteAddr)

Here you can find the source of getSimpleIpport(SocketAddress remoteAddr)

Description

get Simple Ipport

License

Apache License

Declaration

private static String getSimpleIpport(SocketAddress remoteAddr) 

Method Source Code


//package com.java2s;
//License from project: Apache License 

import java.net.InetSocketAddress;
import java.net.SocketAddress;

public class Main {
    private static String getSimpleIpport(SocketAddress remoteAddr) {

        if (remoteAddr == null) {
            return null;
        }/*from ww  w  .j av  a  2  s .c  om*/

        if (remoteAddr instanceof InetSocketAddress) {

            InetSocketAddress addr = (InetSocketAddress) remoteAddr;
            return String.format("%s:%d", addr.getHostString(), addr.getPort());
        }
        return remoteAddr.toString();
    }
}

Related

  1. getOffsettedAddress(InetSocketAddress isa, int offset)
  2. getPort(InetSocketAddress socket)
  3. getPort(SocketAddress socketAddress)
  4. getRandomLoopbackInetSocketAddress(final int port)
  5. getRawAddress(InetSocketAddress inetSocketAddress)
  6. getSocketAddress(InetSocketAddress socket)
  7. getSocketAddress(SocketAddress socketAddress)
  8. getSocketAddress(String hostHeader)
  9. getSocketAddressList(String list, int defaultPort)