[python-win32] Immediately disconnecting a socket in Windows
Marte Soliza
myrtactle at gmail.com
Fri Aug 14 10:28:57 CEST 2009
I'm aware of that but what I need is to disconnect on demand. It will only
disconnect if needed, and not after a fixed time. By the way, I tried to set
the timeout to 0 while the socket is waiting for a response, but it didn't
work (and probably not supposed to work by design).
Thanks.
On Fri, Aug 14, 2009 at 3:59 PM, Gerdus van Zyl <gerdusvanzyl at gmail.com>wrote:
> Do you set a socket timeout value via socket.setdefaulttimeout?
> see:
> http://www.python.org/doc/2.6/library/socket.html#socket.setdefaulttimeout
>
> ~Gerdus
>
> On Thu, Aug 13, 2009 at 7:17 PM, Marte Soliza<myrtactle at gmail.com> wrote:
> > I'm using httplib as an HTTP client for a custom HTTP server. One thing I
> > need is to be able to immediately force disconnect a request that takes
> too
> > long on the server side (and hasn't returned any data) or if the
> connection
> > becomes problematic to the point that no data returns for a long period
> of
> > time. The blocking part happens when getresponse is being called on the
> > HTTPConnection object. In Linux, on a separate thread, I can call
> shutdown
> > on the socket of the connection object and the getresponse call
> immediately
> > raises an error. However, in Windows (XP SP3 in particular), this seems
> to
> > be not the case. It still waits for the server to communicate something
> > back. Do I need to call a Windows-specific function to achieve the same
> as
> > in Linux?
> >
> > Thanks.
> >
> >
> > _______________________________________________
> > python-win32 mailing list
> > python-win32 at python.org
> > http://mail.python.org/mailman/listinfo/python-win32
> >
> >
> _______________________________________________
> python-win32 mailing list
> python-win32 at python.org
> http://mail.python.org/mailman/listinfo/python-win32
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-win32/attachments/20090814/aa5b4b31/attachment.htm>
More information about the python-win32
mailing list