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?
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
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With