Java Socket Address Get socketAddress2String(final SocketAddress addr)

Here you can find the source of socketAddress2String(final SocketAddress addr)

Description

socket Address String

License

Apache License

Declaration

public static String socketAddress2String(final SocketAddress addr) 

Method Source Code

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

import java.net.InetSocketAddress;

import java.net.SocketAddress;

public class Main {
    public static String socketAddress2String(final SocketAddress addr) {
        StringBuilder sb = new StringBuilder();
        InetSocketAddress inetSocketAddress = (InetSocketAddress) addr;
        sb.append(inetSocketAddress.getAddress().getHostAddress());
        sb.append(":");
        sb.append(inetSocketAddress.getPort());
        return sb.toString();
    }/*from  w  w  w . j  a  va  2 s. c  o m*/
}

Related

  1. parseSocketAddress(String addrString)
  2. parseSocketAddress(String anAddress)
  3. parseSocketAddress(String socketAddress)
  4. parseSocketAddressAddr(SocketAddress socketAddress)
  5. sizeOfInet(InetSocketAddress inet)
  6. string2SocketAddress(final String addr)
  7. stringAddressToSocketAddress(String address)
  8. stringifyInetSocketAddressList(InetSocketAddress[] addresses)
  9. stringToInetSocketAddress( String address, int defaultPort)