Path: csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!gegeweb.org!de-l.enfer-du-nord.net!feeder1.enfer-du-nord.net!feeder.news-service.com!newsfeed.xs4all.nl!newsfeed5.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.135 X-Spam-Level: * X-Spam-Evidence: '*H*': 0.73; '*S*': 0.00; 'else:': 0.03; '128': 0.09; 'folks,': 0.09; 'def': 0.12; '"connection': 0.16; 'c.close()': 0.16; 'emanuel': 0.16; 'kb,': 0.16; 'simultaneous': 0.16; 'skip:t 60': 0.16; 'timeout)': 0.16; 'minutes,': 0.23; 'pass': 0.27; 'problem': 0.28; 'random': 0.28; 'import': 0.29; 'skip:i 30': 0.29; 'analyzing': 0.30; 'print': 0.31; "skip:' 10": 0.32; 'headers': 0.32; 'value.': 0.32; 'to:addr:python-list': 0.33; 'thank': 0.35; 'header:User-Agent:1': 0.35; 'skip:" 10': 0.35; 'file:': 0.35; 'try:': 0.35; 'using': 0.35; 'test': 0.35; 'message-id:@gmail.com': 0.36; 'setting': 0.36; 'connection': 0.37; 'received:google.com': 0.37; 'change': 0.37; 'received:209.85': 0.37; 'minutes.': 0.37; 'received:192': 0.38; 'client': 0.39; 'received:209': 0.39; 'finished': 0.39; 'to:addr:python.org': 0.39; 'received:192.168.1': 0.40; 'you.': 0.62; 'lower': 0.64; 'minutes': 0.67; 'high': 0.67; 'transfer': 0.68; 'strange': 0.68; 'received:209.85.216.174': 0.73; 'url:ip addr': 0.74; 'connection.': 0.77; '2.38': 0.84; 'subject:skip:M 20': 0.84; 'url:128': 0.84; 'url:jpg': 0.86; 'url:168': 0.91; 'url:192': 0.91 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:message-id:date:from:user-agent:mime-version:to :subject:content-type:content-transfer-encoding; bh=t2X3LIAXC8wmbEwqfh0GQF+k/7sBM3+T0HbLBaCk8Co=; b=Qz+4A4aTDuOCHSOVXl3VXHxGi7+z8Js21mfmIVrfJwsQUl27/xtLpyXXP+4LH/3u1f YRXJ1ChKuQRMmkIDnBuWr9c1h18+5+CQ985M2+9g25NW5v1jM4Hw/KGP6Oy9vodtNGOk NL5w4PE4EsnjZuxL4l0DTdqWy6NGVRe1FPbr4= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:user-agent:mime-version:to:subject :content-type:content-transfer-encoding; b=KrycY0l1ZK7czfZtadsMW3fYh476KGPszVW7MeOrfjoGOq+fwA5U3CsLKP0vmVfx6X kqo83Ss9KIYlx78BCquh9wuT0ExoI0zZ14KAmFs7cmW1+FwD9CHtGmvvWPTYRF1WPwa7 extbcL3Jmjcfqj01v5e4BDzY7umLepJlwNiRw= Date: Wed, 15 Jun 2011 22:28:22 -0400 From: Emanuel dos Reis Rodrigues User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.1.16) Gecko/20110307 Icedove/3.0.11 MIME-Version: 1.0 To: Python Subject: pycurl and MAX_RECV_SPEED_LARGE Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 83 NNTP-Posting-Host: 82.94.164.166 X-Trace: 1308190969 news.xs4all.nl 49180 [::ffff:82.94.164.166]:55542 X-Complaints-To: abuse@xs4all.nl Xref: x330-a1.tempe.blueboxinc.net comp.lang.python:7722 Hello Folks, I have a problem with pycurl. I need to do a download with a lower rate, + or - 1 Kb / 128bytes. I use the MAX_RECV_SPEED_LARGE setting with 128 as value. My problem is: The download take a long time to be finished. File: test.jpg 92 KB, with 128 rate, take 2.38 Minutes. The strange behavior is that: The connection keep ESTABLISHED only 1/5 from all time ( 2.38 minutes ) Analyzing with wireshark, I see that: After pass 1/5 of all time, do not change packages anymore until reach 2.38 minutes, and client send a RST ACK. Have a high delay between the transfer and the finished connection. I need to solution that I can download with a lower rate, include using Multi-Threading with many simultaneous downloads. Follow my test code: import pycurl import random import os def download1(t_url): headers = [ 'Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8', 'Accept-Language: en-us,pt-br;q=0.8,pt;q=0.5,en;q=0.3', 'Accept-Encoding: gzip,deflate', 'Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7', 'Cache-control: no-cache', 'Pragma: no-cache', 'Connection: Keep-Alive', 'Keep-Alive: 300'] c = pycurl.Curl() f = "/tmp/teste.tmp" c.setopt(c.URL, t_url) c.setopt(c.FAILONERROR, 1) # c.setopt(c.VERBOSE, 1) c.setopt(c.MAX_RECV_SPEED_LARGE, 128) # c.setopt(c.TIMEOUT, timeout) c.setopt(c.NOSIGNAL, 1) c.setopt(pycurl.HTTPHEADER, headers) c.setopt(c.CONNECTTIMEOUT,10) c.setopt(c.WRITEDATA, file(f,"w")) c.setopt(c.USERAGENT,"XADASSDASDASD") try: c.perform() except pycurl.error: print "Connection Problem" c.close() return 2 else: print "Download Complete" print f c.close() return 0 download1("http://192.168.111.128/teste.jpg") Thank You. Emanuel