Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8274757
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T07:50:52+00:00 2026-06-08T07:50:52+00:00

I have linux (Ubuntu) machine as a client. I want to measure data transfer

  • 0

I have linux (Ubuntu) machine as a client. I want to measure data transfer rate when 200 users try to download files from my server at the same time.

Is there some python or linux tool for this? Or can you recommend an approach?

I saw this speedcheck code, and I can wrap it in threads, but I don’t understand why the code there is so “complicated” and the block size changes all the time.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-08T07:50:53+00:00Added an answer on June 8, 2026 at 7:50 am
    import threading
    import time
    import urllib2
    
    block_sz = 8192
    num_threads = 1
    url = "http://192.168.1.1/bigfile2"
    secDownload = 30
    
    class DownloadFileThread(threading.Thread):
        def __init__(self):
            threading.Thread.__init__(self)
    
            self.u = urllib2.urlopen(url)
            self.file_size_dl = 0
    
    
        def run(self):
            while True:
                buffer = self.u.read(block_sz)
                if not buffer:
                    raise 'There is nothing to read. You should have bigger file or smaller time'
    
                self.file_size_dl += len(buffer)
    
    
    if __name__ == "__main__":
        print 'Download from url ' + url + ' use in ' + str(num_threads)  + ' to download. test time ' + str(secDownload)  
            threads = []
            for i in range(num_threads):
                downloadThread = DownloadFileThread()
                downloadThread.daemon = True
                threads.append(downloadThread)
            for i in range(num_threads):
                threads[i].start()
            time.sleep(secDownload)
    
            sumBytes=0
            for i in range(num_threads):
                sumBytes = sumBytes +  threads[i].file_size_dl
            print sumBytes
            print str(sumBytes/(secDownload *1000000)) + 'MBps'
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

If I have a dozen users on my linux machine (Ubuntu 11.10), what are
I have Ubuntu Linux. I found one command will let me download unread message
I have a Perl script on a Linux (Ubuntu 8.10) machine and I need
I am running Linux Ubuntu 10.04 and I have a Windows 7 machine and
I have just created an Ubuntu virtual machine for web development and I want
I have two ubuntu linux boxes: I'm in bash on one machine running some
I have an Ubuntu Linux development machine and a Macbook that I work on.
I have a c++ code that runs perfect on my linux machine (Ubuntu Karmic).
I have a working project on Linux (Ubuntu 11.04), but when i try to
I have two machines I work on: Windows Client (Development Machine) Linux Web Server

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.