简体   繁体   English

以mod_wsgi + python为后端的apache服务器,我如何能够通知我的连接状态?

[英]apache server with mod_wsgi + python as backend, how can i be able to notified my connection status?

i'm trying to build a web server using apache as the http server, mod_wsgi + python as the logic handler, the server was supposed to handler long request without returning, meaning i want to keep writing stuff into this request. 我正在尝试使用apache作为http服务器,使用mod_wsgi + python作为逻辑处理程序来构建Web服务器,该服务器应该处理较长的请求而不会返回,这意味着我想继续向该请求中写入内容。 the problem is, when the link is broken, the socket is in a CLOSE_WAIT status, apache will NOT notify my python program, which means, i have to write something to get an exception, says the link is broken, but those messages were lost and can't be restored. 问题是,当链接断开时,套接字处于CLOSE_WAIT状态,apache不会通知我的python程序,这意味着我必须写一些东西来获取异常,说链接断开了,但是那些消息丢失了并且无法恢复。

i tried to get the socket status before writing through /proc/net/tcp, but it could not prevent a quick connect/break connection. 我试图在通过/ proc / net / tcp写入之前获取套接字状态,但是它无法阻止快速连接/断开连接。

anybody has any ideas, please help, very much thanks in advance! 任何人都有任何想法,请帮助,非常感谢!

You cant. 你不能。 It is a limitation of the API defined by the WSGI specification. 这是WSGI规范定义的API的限制。 So, nothing to do with Apache or mod_wsgi really as you will have the same issue with any WSGI server if you follow the WSGI specification. 因此,与Apache或mod_wsgi毫无关系,因为如果您遵循WSGI规范,那么任何WSGI服务器都会遇到相同的问题。

If you search through the mod_wsgi mailing list on Google Groups you will find a number of discussions about this sort of problem in the past. 如果您在Google网上论坛中搜索mod_wsgi邮件列表,过去会发现许多有关此类问题的讨论。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM