Here you can find the source of IpToString(InetSocketAddress address)
public static String IpToString(InetSocketAddress address)
//package com.java2s; //License from project: Open Source License import java.net.InetSocketAddress; public class Main { public static String IpToString(InetSocketAddress address) { String s = address.getAddress().getHostAddress() + ":" + address.getPort(); return s; }//from w w w .j a v a 2 s . c om }