Code example for Socket

Methods: setKeepAlivesetReceiveBufferSizesetSendBufferSize

0
        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)
            { 
                logger.warn("Failed to set send buffer size on Thrift socket.", se);
            } 
        } 
 
        if (this.recvBufferSize != null)
        { 
            try 
            { 
                socket.setReceiveBufferSize(this.recvBufferSize.intValue());
            } 
            catch (SocketException se)
            { 
                logger.warn("Failed to set receive buffer size on Thrift socket.", se);
            }