[ https://issues.apache.org/jira/browse/SSHD-722?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15734986#comment-15734986 ]
Goldstein Lyor commented on SSHD-722: ------------------------------------- Have you encountered a problem ? Please note that the {{org.apache.sshd.common.io.nio2.Nio2Acceptor.bind(Collection<? extends SocketAddress>)}} code clearly checks the supported options via the {{org.apache.sshd.common.io.nio2.Nio2Service.setOption(NetworkChannel, String, SocketOption<T>, T)}} invocation. At most you will be getting a warning. {code:java|title=Nio2Service.setOption} if (val != null) { Collection<? extends SocketOption<?>> supported = socket.supportedOptions(); if ((GenericUtils.size(supported) <= 0) || (!supported.contains(option))) { log.warn("Unsupported socket option (" + option + ") to set using property '" + property + "' value=" + val); return; } try { socket.setOption(option, val); if (log.isDebugEnabled()) { log.debug("setOption({})[{}] from property={}", option, val, property); } } catch (IOException | RuntimeException e) { log.warn("Unable (" + e.getClass().getSimpleName() + ")" + " to set socket option " + option + " using property '" + property + "' value=" + val + ": " + e.getMessage()); } } {code} > Failed to setting SO_KEEPALIVE option for sshd server socket > ------------------------------------------------------------ > > Key: SSHD-722 > URL: https://issues.apache.org/jira/browse/SSHD-722 > Project: MINA SSHD > Issue Type: Bug > Affects Versions: 1.3.0 > Reporter: Li Fangning > Assignee: Goldstein Lyor > Priority: Minor > > Use the following code to set the SO_KEEPALIVE property: > PropertyResolverUtils.updateProperty(sshd, SshServer.SOCKET_KEEPALIVE, true) > I get the error message: Unsupported socket option (SO_KEEPALIVE) to set > ...... > After I check the code in org.apache.sshd.common.io.nio2.Nio2Acceptor#bind(), > I found that the SO_KEEPALIVE option is set on the > AsynchronousServerSocketChannel, i.e. a listening socket which can only > accept new incoming connections and not exchange data. The socket option is > not applicable to a listening socket. > (https://docs.oracle.com/javase/8/docs/api/java/nio/channels/AsynchronousServerSocketChannel.html) > Whether this code can be changed to the > org.apache.sshd.common.io.nio2.Nio2Acceptor$AcceptCompletionHandler#onCompleted(), > and set the options on the AsynchronousSocketChannel object? > SO_SENDBUF, TCP_NODELAY options have the same issue. -- This message was sent by Atlassian JIRA (v6.3.4#6332)