@Override public void setReuseAddress(boolean on) throws SocketException { sock.setReuseAddress(on); }
@Override public SocketChannelConfig setReuseAddress(boolean reuseAddress) { try { javaSocket.setReuseAddress(reuseAddress); } catch (SocketException e) { throw new ChannelException(e); } return this; }
@Override public SocketChannelConfig setReuseAddress(boolean reuseAddress) { try { javaSocket.setReuseAddress(reuseAddress); } catch (SocketException e) { throw new ChannelException(e); } return this; }
public static BioSocketChannel open(SocketAddress address) throws Exception { Socket socket = new Socket(); socket.setSoTimeout(BioSocketChannel.SO_TIMEOUT); socket.setTcpNoDelay(true); socket.setKeepAlive(true); socket.setReuseAddress(true); socket.connect(address, BioSocketChannel.DEFAULT_CONNECT_TIMEOUT); return new BioSocketChannel(socket); }
/** * See {@link Socket#setReuseAddress(boolean)}. Calling this method does not trigger mode detection. */ @Override public void setReuseAddress(boolean on) throws SocketException { getSocketAllowUnknownMode().setReuseAddress(on); }
private void configureSocket(SocketChannel socketChannel) throws IOException { socketChannel.configureBlocking(false); Socket socket = socketChannel.socket(); socket.setTcpNoDelay(noDelay); socket.setReceiveBufferSize(bufSize); socket.setSendBufferSize(bufSize); socket.setReuseAddress(true); }
private void configureSocket(SocketChannel socketChannel) throws IOException { socketChannel.configureBlocking(false); Socket socket = socketChannel.socket(); socket.setTcpNoDelay(noDelay); socket.setReceiveBufferSize(bufSize); socket.setSendBufferSize(bufSize); socket.setReuseAddress(true); }
@Override public SocketChannelConfig setReuseAddress(boolean reuseAddress) { try { javaSocket.setReuseAddress(reuseAddress); } catch (SocketException e) { throw new ChannelException(e); } return this; }
public void setReuseAddress(boolean reuseAddress) { try { socket.setReuseAddress(reuseAddress); } catch (SocketException e) { throw new ChannelException(e); } }
public SocketChannel getTCPSocket() throws IOException { // Under lock, claim an existing open socket if possible synchronized(this) { // Limit myself to the number of open sockets from node-to-node while( _socksAvail == 0 ) try { wait(); } catch( InterruptedException ie ) { } // Claim an open socket SocketChannel sock = _socks[--_socksAvail]; if( sock != null ) { if( sock.isOpen() ) return sock; // Return existing socket! // Else its an already-closed socket, lower open TCP count assert TCPS.get() > 0; TCPS.decrementAndGet(); } } // Must make a fresh socket SocketChannel sock2 = SocketChannel.open(); sock2.socket().setReuseAddress(true); sock2.socket().setSendBufferSize(AutoBuffer.BBSIZE); boolean res = sock2.connect( _key ); assert res && !sock2.isConnectionPending() && sock2.isBlocking() && sock2.isConnected() && sock2.isOpen(); TCPS.incrementAndGet(); // Cluster-wide counting return sock2; } public synchronized void freeTCPSocket( SocketChannel sock ) {
@Signature(@Arg("on")) public Memory setReuseAddress(Environment env, Memory... args) throws SocketException { socket.setReuseAddress(args[0].toBoolean()); return Memory.NULL; }
public void connect() { if (!isConnected()) { try { socket = new Socket(); // ->@wjw_add socket.setReuseAddress(true); socket.setKeepAlive(true); // Will monitor the TCP connection is // valid socket.setTcpNoDelay(true); // Socket buffer Whetherclosed, to // ensure timely delivery of data socket.setSoLinger(true, 0); // Control calls close () method, // the underlying socket is closed // immediately // <-@wjw_add socket.connect(new InetSocketAddress(host, port), connectionTimeout); socket.setSoTimeout(soTimeout); outputStream = new RedisOutputStream(socket.getOutputStream()); inputStream = new RedisInputStream(socket.getInputStream()); } catch (IOException ex) { UsefulDataCollector.collectException(ex, getHostPort(), System.currentTimeMillis()); broken = true; throw new JedisConnectionException(ex); } } }
try { s = new Socket(); s.setReuseAddress( true ); SocketAddress sa = new InetSocketAddress( value.getPublicIpAddress(), 22 ); s.connect( sa, 2000 );
socket.setReuseAddress( isReuseAddr() );
channel.socket().setReuseAddress(true); channel.socket().setKeepAlive(true); channel.socket().setTcpNoDelay(true);
public void open(int serverId) { close(); Server server = ServerManager.getInstance().getServer(serverId); if (server == null) { return; } try { socket = new Socket(); socket.setKeepAlive(false); socket.setTcpNoDelay(true); socket.setPerformancePreferences(0, 2, 1); socket.setReuseAddress(true); socket.setSoLinger(true, 1000); socket.connect(new InetSocketAddress(server.getIp(), server.getPort()),3000); socket.setSoTimeout(server.getSoTimeOut()); in = new DataInputX(new BufferedInputStream(socket.getInputStream())); out = new DataOutputX(new BufferedOutputStream(socket.getOutputStream())); out.writeInt(NetCafe.TCP_CLIENT); out.flush(); log.info("Connected {} to {}:{}", this, server.getIp(), server.getPort()); } catch (Throwable t) { log.error(t.getMessage()); close(); } }
socketChannel.socket().setReuseAddress(serverConfig.getReuseAddress());
socketChannel.socket().setReuseAddress(serverConfig.getReuseAddress());
socketChannel.socket().setReuseAddress(clientConfig.getReuseAddress());
socketChannel.socket().setReuseAddress(clientConfig.getReuseAddress());