What does SO_TIMEOUT and CONNECT_TIMEOUT_MILLIS means in Netty's ChannelOption?
java, netty, sockets, timeout
Solution
`CONNECT_TIMEOUT_MILLIS` means timeout value to setup a connection, this timeout is supported by Netty.
`SO_TIMEOUT` is option for socket, it will impact: | `ServerSocket.accept();` | `SocketInputStream.read()` | `DatagramSocket.receive()`
For more details please check: http://docs.oracle.com/javase/1.5.0/docs/api/java/net/SocketOptions.html#SO_TIMEOUT
If you just want to control request timeout, you could try Netty's `ReadTimeoutHandler` or `IdleTimeoutHandler`.
Problem
What does `SO_TIMEOUT` and `CONNECT_TIMEOUT_MILLIS` mean and what is the difference between them? I have found that: many request cost 3.004s and my handler always cost 0.003s or 0.004s and I set the `SO_TIMEOUT` to 3000 , is there a relationship among them? I think `SO_TIMEOUT` means that when a response is not send in `SO_TIMEOUT time`, send this response immediately. Is this correct?