@Override public SocketAddress getRemoteAddress() throws IOException { return ac.getRemoteAddress(); }
public InetSocketAddress getRemoteSocketAddress() throws IOException { return (InetSocketAddress) sock.getRemoteAddress(); }
/** * @return the remote address * @throws IOException */ public SocketAddress getRemoteAddress() throws IOException { return this.channel.getRemoteAddress(); }
public SocketAddress getRemoteAddress() throws IOException { return ac.getRemoteAddress(); }
private int remotePort() throws IOException { return ((java.net.InetSocketAddress) ac.getRemoteAddress()).getPort(); } }
@Override public InetSocketAddress getRemoteAddress() { if (remoteAddress != null) { return remoteAddress; } else { try { remoteAddress = (InetSocketAddress) socketChannel.getRemoteAddress(); return remoteAddress; } catch (Throwable t) { log.error("The session {} gets remote address error", t, sessionId); return null; } } }
public void close(){ try { log.debug("Session close to " + socketChannel.getRemoteAddress()); closed = true; //socketChannel.close(); } catch (Exception e) { e.printStackTrace(); } }
public String getClientIP(){ //IPStr: /XXX.XXX.XXX.XXX:XXXXX String IPStr = null; try { IPStr = socketChannel.getRemoteAddress().toString().substring(1, socketChannel.getRemoteAddress().toString().indexOf(":")); } catch (Exception e) { log.error(e.getMessage()); } return IPStr; } }
public String toString(){ String str = ""; try { str = socketChannel.getRemoteAddress().toString(); } catch (IOException e) { log.error(e.getMessage()); } return str; }
public Nio2Session(Nio2Service service, FactoryManager manager, IoHandler handler, AsynchronousSocketChannel socket) throws IOException { this.service = Objects.requireNonNull(service, "No service instance"); this.manager = Objects.requireNonNull(manager, "No factory manager"); this.ioHandler = Objects.requireNonNull(handler, "No IoHandler"); this.socketChannel = Objects.requireNonNull(socket, "No socket channel"); this.localAddress = socket.getLocalAddress(); this.remoteAddress = socket.getRemoteAddress(); if (log.isDebugEnabled()) { log.debug("Creating IoSession on {} from {}", localAddress, remoteAddress); } }
/** * @see AsynchronousSocketChannel#getRemoteAddress() */ public final InetSocketAddress getRemoteAddress() throws IOException { assertChannel(); return (InetSocketAddress) channel.getRemoteAddress(); }
public Nio2Session(org.xbib.io.sshd.common.io.nio2.Nio2Service service, FactoryManager manager, IoHandler handler, AsynchronousSocketChannel socket) throws IOException { this.service = Objects.requireNonNull(service, "No service instance"); this.manager = Objects.requireNonNull(manager, "No factory manager"); this.ioHandler = Objects.requireNonNull(handler, "No IoHandler"); this.socketChannel = Objects.requireNonNull(socket, "No socket channel"); this.localAddress = socket.getLocalAddress(); this.remoteAddress = socket.getRemoteAddress(); }
@Override public int getRemotePort() { try { return ((InetSocketAddress)socket.getRemoteAddress()).getPort(); } catch (IOException e) { throw new SocketInfoException(e); } }
@Override public InetAddress getRemoteAddress() { try { return ((InetSocketAddress)socket.getRemoteAddress()).getAddress(); } catch (IOException e) { throw new SocketInfoException(e); } }
public static long getClientIdBySocketChannel(AsynchronousSocketChannel socketChannel) throws IOException{ InetSocketAddress address = (InetSocketAddress)socketChannel.getRemoteAddress(); byte[] quad = address.getAddress().getAddress(); int port = address.getPort(); long clientId = NetworkUtil.convertIpPortToUniqueId(quad, port); return clientId; }
public void start(){ try { log.debug("Session start from " + socketChannel.getRemoteAddress()); } catch (Exception e) { e.printStackTrace(); } receive(); }
@Override protected void populateRemoteAddr() { SocketAddress socketAddress = null; try { socketAddress = getSocket().getIOChannel().getRemoteAddress(); } catch (IOException e) { // Ignore } if (socketAddress instanceof InetSocketAddress) { remoteAddr = ((InetSocketAddress) socketAddress).getAddress().getHostAddress(); } }
@Override public NioChannel acceptChannel(AsynchronousServerSocketChannel listener) throws IOException { try { AsynchronousSocketChannel asyncChannel = listener.accept().get(); InetSocketAddress addr = (InetSocketAddress) asyncChannel.getRemoteAddress(); SSLEngine engine = sslContext.createSSLEngine(addr.getHostString(), addr.getPort()); NioChannel channel = new SecureNioChannel(asyncChannel, engine); return channel; } catch (Exception e) { throw new IOException(MESSAGES.sslHandshakeError(), e); } }
public Writter(ByteBuffer data, A2 att, CompletionHandler<ByteBuffer, A2> callback) { this.data = data; this.att = att; this.callback = callback; }
@Override protected void populateRemotePort() { SocketAddress socketAddress = null; try { socketAddress = getSocket().getIOChannel().getRemoteAddress(); } catch (IOException e) { log.warn(sm.getString("endpoint.warn.noRemotePort", getSocket()), e); } if (socketAddress instanceof InetSocketAddress) { remotePort = ((InetSocketAddress) socketAddress).getPort(); } }