Here you can find the source of remoteAddress(SocketChannel channel)
public static String remoteAddress(SocketChannel channel)
//package com.java2s; //License from project: Open Source License import java.net.SocketAddress; import java.nio.channels.SocketChannel; public class Main { public static String remoteAddress(SocketChannel channel) { SocketAddress addr = channel.socket().getRemoteSocketAddress(); String res = String.format("%s", addr); return res; }//from w ww . jav a 2s .c o m }