且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何设置码头服务器的连接/请求超时?

更新时间:2023-01-03 13:13:32

看看SelectChannelConnector(Jetty)的API:

Take a look at the API for SelectChannelConnector (Jetty):

http: //download.eclipse.org/jetty/7.6.17.v20150415/apidocs/org/eclipse/jetty/server/nio/SelectChannelConnector.html

我试图找到该通道的任何超时功能(用于控制传入连接):setMaxIdleTime(),setLowResourceMaxIdleTime()和setSoLingerTime()可用.

I've tried to locate any timeout features of the channel (which controls incoming connections): setMaxIdleTime(), setLowResourceMaxIdleTime() and setSoLingerTime() are available it appears.

注意:超时功能不起作用的原因与操作系统上套接字的性质有关.也许甚至连码头的性质(我已经在某处读过它,但不记得它在哪里).

NOTE: the reason for your timeout feature not to work has to do with the nature of the socket on your operating system. Perhaps even the nature of Jetty (i've read about it somewhere, but cannot remember where it was).

注意2:我不确定为什么要尝试限制超时,也许更好的方法是限制缓冲区大小?如果您要防止拒绝服务...

NOTE2: i'm not sure why you try to limit the timeout, perhaps a better approach is limiting the buffer sizes? If you're trying to prevent denial of service...