[ 
https://issues.apache.org/jira/browse/HTTPCORE-761?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

kkewwei updated HTTPCORE-761:
-----------------------------
    Description: 
It's known that TCP Keep-Alive time  is 7200 seconds(default), default 
parameters do not meet all needs.

If we could support setting TCP_KEEPIDLE, TCP_KEEPINTERVAL, TCP_KEEPCOUNT in 
Socket here.
[SingleCoreIOReactor|https://github.com/apache/httpcomponents-core/blob/0d4aeb557737ac717e62c6375ca0d8a86f5f886b/httpcore5/src/main/java/org/apache/hc/core5/reactor/SingleCoreIOReactor.java#L268]
{code:java}
    private void.prepareSocket(final Socket socket) throws IOException {
        socket.setTcpNoDelay(this.reactorConfig.isTcpNoDelay());
        socket.setKeepAlive(this.reactorConfig.isSoKeepAlive());
        if (this.reactorConfig.getSndBufSize() > 0) {
            socket.setSendBufferSize(this.reactorConfig.getSndBufSize());
        }
        if (this.reactorConfig.getRcvBufSize() > 0) {
            socket.setReceiveBufferSize(this.reactorConfig.getRcvBufSize());
        }
        if (this.reactorConfig.getTrafficClass() > 0) {
            socket.setTrafficClass(this.reactorConfig.getTrafficClass());
        }
        final int linger = this.reactorConfig.getSoLinger().toSecondsIntBound();
        if (linger >= 0) {
            socket.setSoLinger(true, linger);
        }
    }
{code}


  was:
It's known that TCP Keep-Alive time  is 7200 seconds(default), default 
parameters do not meet all needs.

If we could support setting TCP_KEEPIDLE, TCP_KEEPINTERVAL, TCP_KEEPCOUNT in 
Socket here.

{code:java}
    private void SingleCoreIOReactor.prepareSocket(final Socket socket) throws 
IOException {
        socket.setTcpNoDelay(this.reactorConfig.isTcpNoDelay());
        socket.setKeepAlive(this.reactorConfig.isSoKeepAlive());
        if (this.reactorConfig.getSndBufSize() > 0) {
            socket.setSendBufferSize(this.reactorConfig.getSndBufSize());
        }
        if (this.reactorConfig.getRcvBufSize() > 0) {
            socket.setReceiveBufferSize(this.reactorConfig.getRcvBufSize());
        }
        if (this.reactorConfig.getTrafficClass() > 0) {
            socket.setTrafficClass(this.reactorConfig.getTrafficClass());
        }
        final int linger = this.reactorConfig.getSoLinger().toSecondsIntBound();
        if (linger >= 0) {
            socket.setSoLinger(true, linger);
        }
    }
{code}



> support params TCP_KEEPIDLE/TCP_KEEPINTERVAL/TCP_KEEPCOUNT in Socket
> --------------------------------------------------------------------
>
>                 Key: HTTPCORE-761
>                 URL: https://issues.apache.org/jira/browse/HTTPCORE-761
>             Project: HttpComponents HttpCore
>          Issue Type: Improvement
>          Components: HttpCore
>            Reporter: kkewwei
>            Priority: Major
>
> It's known that TCP Keep-Alive time  is 7200 seconds(default), default 
> parameters do not meet all needs.
> If we could support setting TCP_KEEPIDLE, TCP_KEEPINTERVAL, TCP_KEEPCOUNT in 
> Socket here.
> [SingleCoreIOReactor|https://github.com/apache/httpcomponents-core/blob/0d4aeb557737ac717e62c6375ca0d8a86f5f886b/httpcore5/src/main/java/org/apache/hc/core5/reactor/SingleCoreIOReactor.java#L268]
> {code:java}
>     private void.prepareSocket(final Socket socket) throws IOException {
>         socket.setTcpNoDelay(this.reactorConfig.isTcpNoDelay());
>         socket.setKeepAlive(this.reactorConfig.isSoKeepAlive());
>         if (this.reactorConfig.getSndBufSize() > 0) {
>             socket.setSendBufferSize(this.reactorConfig.getSndBufSize());
>         }
>         if (this.reactorConfig.getRcvBufSize() > 0) {
>             socket.setReceiveBufferSize(this.reactorConfig.getRcvBufSize());
>         }
>         if (this.reactorConfig.getTrafficClass() > 0) {
>             socket.setTrafficClass(this.reactorConfig.getTrafficClass());
>         }
>         final int linger = 
> this.reactorConfig.getSoLinger().toSecondsIntBound();
>         if (linger >= 0) {
>             socket.setSoLinger(true, linger);
>         }
>     }
> {code}



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@hc.apache.org
For additional commands, e-mail: dev-h...@hc.apache.org

Reply via email to