Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What does SO_TIMEOUT and CONNECT_TIMEOUT_MILLIS means in netty's ChannelOption?

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?

like image 714
BabyDuncan Avatar asked Jan 08 '14 03:01

BabyDuncan


Video Answer


1 Answers

  • 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.

like image 82
Jian Jin Avatar answered Oct 20 '22 15:10

Jian Jin