pcurl and network connection's problem

S

sam319

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 willbe 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
 
P

Prasad, Ramit

sam319 said:
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 andcompleteness of information, viruses, confidentiality, legal privilege, andlegal entity disclaimers, available at http://www.jpmorgan.com/pages/disclosures/email.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,780
Messages
2,569,607
Members
45,241
Latest member
Lisa1997

Latest Threads

Top