Socket setReceiveBufferSize - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Socket setReceiveBufferSize method.

This code example shows how to use the following methods:connect, getReceiveBufferSize, setReceiveBufferSize
     
    public Bridge(Socket socket, URI target) throws Exception {
      receiveSocket = socket;
      sendSocket = createSocket(target);
      if (receiveBufferSize > 0) {
        sendSocket.setReceiveBufferSize(receiveBufferSize);
      } 
      sendSocket.connect(new InetSocketAddress(target.getHost(), target
          .getPort()));
      linkWithThreads(receiveSocket, sendSocket);
      log.info("proxy connection " + sendSocket + ", receiveBufferSize="
          + sendSocket.getReceiveBufferSize());
    } 
     
    public void goOn() { 
      responseThread.goOn();
      requestThread.goOn();
    } 
     
    public void pause() { 

7
CodeRank
This code example shows how to use the following methods:getKeepAlive, getReceiveBufferSize, getReuseAddress, getSendBufferSize, getSoLinger
7
CodeRank
This code example shows how to use the following methods:setReceiveBufferSize
    } 
 
    @Override 
    public SocketChannelConfig setReceiveBufferSize(int receiveBufferSize) {
        try { 
            javaSocket.setReceiveBufferSize(receiveBufferSize);
        } 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;
6
CodeRank
This code example shows how to use the following methods:setKeepAlive, setReceiveBufferSize, setSendBufferSize
        TSocket tsocket = super.acceptImpl();
        Socket socket = tsocket.getSocket();
 
        try 
        { 
            socket.setKeepAlive(this.keepAlive);
        } 
        catch (SocketException se)
        { 
            logger.warn("Failed to set keep-alive on Thrift socket.", se);
        } 
 
        if (this.sendBufferSize != null)
        { 
            try 
            { 
                socket.setSendBufferSize(this.sendBufferSize.intValue());
            } 
            catch (SocketException se)
            { 

6
CodeRank
This code example shows how to use the following methods:setReceiveBufferSize
	this.socket.setKeepAlive(on);
    } 
 
    public void setReceiveBufferSize(int size)
	throws SocketException { 
	this.socket.setReceiveBufferSize(size);
    } 
 
    public void setSendBufferSize(int size)
	throws SocketException { 
	this.socket.setSendBufferSize(size);
    } 
     
    public void setSoLinger(boolean on,
			    int linger)
	throws SocketException { 
	this.socket.setSoLinger(on, linger);
    } 
     
    public void setSoTimeout(int timeout)
6
CodeRank
This code example shows how to use the following methods:setKeepAlive, setReceiveBufferSize, setSendBufferSize, setTcpNoDelay
        SocketChannel channel = null;
        try { 
            channel = SocketChannel.open();
            channel.configureBlocking(false);
            Socket socket = channel.socket();
            socket.setReceiveBufferSize(socketRecvBuffer);
            socket.setSendBufferSize(socketSendBuffer);
            socket.setTcpNoDelay(true);
            socket.setKeepAlive(true);
        } catch (IOException e) {
            closeChannel(channel);
            throw e;
        } catch (RuntimeException e) {
            closeChannel(channel);
            throw e;
        } 
        return channel;
    } 
 
    protected void postConnect(BackendConnection c, NIOConnector connector) {
6
CodeRank
This code example shows how to use the following methods:close, setReceiveBufferSize
        SetReceiveBufferSize s = new SetReceiveBufferSize();
    } 
 
    public SetReceiveBufferSize() throws Exception { 
        ServerSocket ss = new ServerSocket(0);
        Socket s = new Socket("localhost", ss.getLocalPort());
        Socket accepted = ss.accept();
        try { 
            s.setReceiveBufferSize(0);
        } catch (IllegalArgumentException e) {
            return; 
        } catch (Exception ex) {
        } finally { 
            ss.close();
            s.close();
            accepted.close();
        } 
        throw new RuntimeException("IllegalArgumentException not thrown!");
    } 
} 
7
CodeRank
This code example shows how to use the following methods:connect, getInputStream, getOutputStream, setReceiveBufferSize, setSoTimeout
This code example shows how to use the following methods:setReceiveBufferSize
        socket.setSendBufferSize(size);
    } 
 
    @Override 
    public void setReceiveBufferSize(int size) throws SocketException {
        socket.setReceiveBufferSize(size);
    } 
 
    @Override 
    public boolean getTcpNoDelay() throws SocketException { 
        return socket.getTcpNoDelay();
    } 
 
    @Override 
    public boolean getReuseAddress() throws SocketException { 
        return socket.getReuseAddress();
    } 
 
    @Override 
    public boolean getOOBInline() throws SocketException { 
6
CodeRank
This code example shows how to use the following methods:setKeepAlive, setReceiveBufferSize, setTcpNoDelay
 
	/** 
	 *  
	 */ 
	public Socket create(String host, int port) throws Exception {
		final Socket r = new Socket(host, port);
		r.setKeepAlive(this.keepAlive);
		r.setTcpNoDelay(this.tcpNoDelay);
		if(this.receiveBufferSize > 0) r.setReceiveBufferSize(this.receiveBufferSize);
		return r;
	} 
	 
	/** 
	 *  
	 */ 
	public boolean isKeepAlive() { 
		return keepAlive;
	} 
 
	public void setKeepAlive(boolean keepAlive) {
6
CodeRank

Related Socket setReceiveBufferSize Questions & Answers:

setReceiveBufferSize Method Overview
Sets the SO_RCVBUF option to the specified value for this Socket.
See Code Examples for other Java 8 Socket Methods: