Example usage for java.net ServerSocket getChannel

List of usage examples for java.net ServerSocket getChannel

Introduction

In this page you can find the example usage for java.net ServerSocket getChannel.

Prototype

public ServerSocketChannel getChannel() 

Source Link

Document

Returns the unique java.nio.channels.ServerSocketChannel object associated with this socket, if any.

Usage

From source file:Main.java

/**
 * Renders the details of a server socket in the returned string
 * @param socket The server socket to render
 * @return the details of the server socket as a string
 */// ww  w  . j a  v a  2  s.c om
public static String render(ServerSocket socket) {
    if (socket == null)
        return "NULL";
    StringBuilder b = new StringBuilder("\nSocket [");
    b.append("\n\tLocalPort:").append(socket.getLocalPort());
    b.append("\n\tLocalAddress:").append(socket.getInetAddress());
    b.append("\n\tLocalSocketAddress:").append(socket.getLocalSocketAddress());
    b.append("\n\tChannel:").append(socket.getChannel());
    b.append("\n\tHashCode:").append(socket.hashCode());
    b.append("\n]");
    return b.toString();
}