Code example for InetSocketAddress

Methods: getHostStringgetPort

0
        Node node = this.nodes.get(address);
        if (node != null) return node;
 
        Channel channel = this.channel.getValue();
        IpAddress ipAddress = (IpAddress) channel.down(new Event(Event.GET_PHYSICAL_ADDRESS, address));
        InetSocketAddress socketAddress = new InetSocketAddress(ipAddress.getIpAddress(), ipAddress.getPort());
        String name = channel.getName(address);
        if (name == null) {
            name = String.format("%s:%s", socketAddress.getHostString(), socketAddress.getPort());
        } 
        node = new AddressableNode(address, name, socketAddress);
        Node existing = this.nodes.putIfAbsent(address, node);
        return (existing != null) ? existing : node;
    } 
 
    @Override 
    public ChannelNodeFactory getValue() { 
        return this;
    }