Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #51695 > unrolled thread

pcurl and network connection's problem

Started bysam319 <samaneh.yahyapour@gmail.com>
First post2013-07-31 12:12 -0700
Last post2013-07-31 19:32 +0000
Articles 2 — 2 participants

Back to article view | Back to comp.lang.python


Contents

  pcurl and network connection's problem sam319 <samaneh.yahyapour@gmail.com> - 2013-07-31 12:12 -0700
    RE: pcurl and network connection's problem "Prasad, Ramit" <ramit.prasad@jpmorgan.com.dmarc.invalid> - 2013-07-31 19:32 +0000

#51695 — pcurl and network connection's problem

Fromsam319 <samaneh.yahyapour@gmail.com>
Date2013-07-31 12:12 -0700
Subjectpcurl and network connection's problem
Message-ID<2271ec9a-ec36-485b-9776-3c7157cedae1@googlegroups.com>
I am having problems with pycurl in my threads , when i run it , it does correctly but some times the connection has been established but nothing will be downloaded and the threads stay alive without doing any thing (especially when the network's speed is slow and has aborted status) .

i can't use TIMEOUT  because i don't have the max time for downloading 

how can i solve this problem in python

[toc] | [next] | [standalone]


#51698

From"Prasad, Ramit" <ramit.prasad@jpmorgan.com.dmarc.invalid>
Date2013-07-31 19:32 +0000
Message-ID<mailman.53.1375299192.1251.python-list@python.org>
In reply to#51695
sam319 wrote:
> I am having problems with pycurl in my threads , when i run it , it does correctly but some times the
> connection has been established but nothing will be downloaded and the threads stay alive without
> doing any thing (especially when the network's speed is slow and has aborted status) .
> 
> i can't use TIMEOUT  because i don't have the max time for downloading
> 
> how can i solve this problem in python

So you want to wait hours/days/years for a failed download? You should always set a 
timeout that is sane. If you anticipate network slowness, then set your timeout to 
something larger like 2-3 minutes. IIRC, the timeout only affects connection
establishment so that will not help out your use case but I want to emphasize
that you always want a timeout to be set. 

Pycurl has an option for LOW_SPEED_LIMIT/LOW_SPEED_TIME which should allow you to set 
a minimum transfer speed which will abort the transfer. This should solve your problem
where the connection is created but nothing is being downloaded.

See: http://stackoverflow.com/questions/4960021/handle-pycurl-hang-on-twitter-streaming-api


Ramit



This email is confidential and subject to important disclaimers and conditions including on offers for the purchase or sale of securities, accuracy and completeness of information, viruses, confidentiality, legal privilege, and legal entity disclaimers, available at http://www.jpmorgan.com/pages/disclosures/email.  

[toc] | [prev] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web