@Override public Void run() throws IOException { socketChannel.bind(address); return null; } });
@Override public Void run() throws IOException { socketChannel.bind(address); return null; } });
@Override public Void run() throws IOException { socketChannel.bind(address); return null; } });
public SSLSocketChannel(final SSLContext sslContext, final String hostname, final int port, final InetAddress localAddress, final boolean client) throws IOException { this.socketAddress = new InetSocketAddress(hostname, port); this.channel = SocketChannel.open(); if (localAddress != null) { final SocketAddress localSocketAddress = new InetSocketAddress(localAddress, 0); this.channel.bind(localSocketAddress); } this.hostname = hostname; this.port = port; this.engine = sslContext.createSSLEngine(); this.engine.setUseClientMode(client); engine.setNeedClientAuth(true); streamInManager = new BufferStateManager(ByteBuffer.allocate(engine.getSession().getPacketBufferSize())); streamOutManager = new BufferStateManager(ByteBuffer.allocate(engine.getSession().getPacketBufferSize())); appDataManager = new BufferStateManager(ByteBuffer.allocate(engine.getSession().getApplicationBufferSize())); }
protected void connect(Address dest, boolean send_local_addr) throws Exception { SocketAddress destAddr=new InetSocketAddress(((IpAddress)dest).getIpAddress(), ((IpAddress)dest).getPort()); try { if(!server.deferClientBinding()) this.channel.bind(new InetSocketAddress(server.clientBindAddress(), server.clientBindPort())); this.key=server.register(channel, SelectionKey.OP_CONNECT | SelectionKey.OP_READ, this); if(Util.connect(channel, destAddr) && channel.finishConnect()) { clearSelectionKey(SelectionKey.OP_CONNECT); this.connected=channel.isConnected(); } if(this.channel.getLocalAddress() != null && this.channel.getLocalAddress().equals(destAddr)) throw new IllegalStateException("socket's bind and connect address are the same: " + destAddr); if(send_local_addr) sendLocalAddress(server.localAddress()); } catch(Exception t) { close(); throw t; } }
@Override public Void run() throws IOException { socketChannel.bind(address); return null; } });
socket.bind(new InetSocketAddress(address, 8080));
@Override public Void run() throws IOException { socketChannel.bind(address); return null; } });
@Override public Void run() throws IOException { socketChannel.bind(address); return null; } });
/** * {@inheritDoc} * * Forwards to {@link #delegate} and returns {@code this}. */ @Override public SocketChannel bind(SocketAddress local) throws IOException { delegate.bind(local); return this; }
@Override public Void run() throws IOException { socketChannel.bind(address); return null; } });
@Override public Void run() throws IOException { socketChannel.bind(address); return null; } });
@Override public Void run() throws IOException { socketChannel.bind(address); return null; } });
@Override public Void run() throws IOException { socketChannel.bind(address); return null; } });
@Override public Void run() throws IOException { socketChannel.bind(address); return null; } });
@Override public Void run() throws IOException { socketChannel.bind(address); return null; } });
@Override public SocketChannel bind(SocketAddress socketAddress) throws IOException { return socketChannel.bind(socketAddress); }
private void prepareChannel(SocketChannel channel, SocketAddress addr) throws IOException { if (mBindAddress != null) { channel.bind(mBindAddress); } channel.configureBlocking(false); channel.register(mSelector, SelectionKey.OP_CONNECT); channel.connect(addr); }
private void doInitiateConnectionTcp() throws IOException { // Create a non-blocking socket channel this.socketChannelTcp = SocketChannel.open(); this.socketChannelTcp.configureBlocking(false); // bind to host address:port this.socketChannelTcp.bind(new InetSocketAddress(this.hostAddress, this.hostPort)); // Kick off connection establishment this.socketChannelTcp.connect(new InetSocketAddress(this.peerAddress, this.peerPort)); }
private void doBind0(SocketAddress localAddress) throws Exception { if (PlatformDependent.javaVersion() >= 7) { javaChannel().bind(localAddress); } else { javaChannel().socket().bind(localAddress); } }