Jump to content

Test Download Speed with Wireshark


rev.dennis
 Share

Recommended Posts

It sure would be helpful to find out what actual network/bandwidth speed is versus relying on other tools.

Utilize Wireshark to monitor your network card to get an accurate representation of your bandwidth.

If you have a trace running as you download a file go to Statistics - IO Graph draw a graph in the outbound direction only. Change the Y-axis to bits/tick if you want to see bandwidth.

Maybe you are using a Linux system or just like using tcpdump.  TCPdump doesn't give you the real-time stats but you can feed it's output to something that does.

$ sudo tcpdump -i eth1 -l -e -n | ./netbps

tcpdump

: verbose output suppressed, use -v or -vv for full protocol decode

listening on eth1

, link-type EN10MB (Ethernet), capture size 96 bytes

11:36:53 2143.33 Bps

11:37:03 1995.99 Bps

11:37:13 2008.35 Bps

11:37:23 1999.97 Bps

11:37:33 2083.32 Bps

131 packets captured

131 packets received by filter

0 packets dropped by kernel

You'd need to add a suitable filter expression at the end of the tcpdump command to only include the traffic generated by your app (e.g. port 80)

The program netbps is this:

#!/usr/bin/perl

use strict

;

use warnings

;

use

Time::HiRes;

my $reporting_interval

= 10.0; # seconds

my $bytes_this_interval

= 0;

my $start_time

= [Time::HiRes::gettimeofday()];

while (<>) {

if (/ length (\d+):/) {

$bytes_this_interval

+= $1;

my $elapsed_seconds

= Time::HiRes::tv_interval($start_time);

if ($elapsed_seconds > $reporting_interval) {

my $bps

= $bytes_this_interval / $elapsed_seconds;

printf

"%02d:%02d:%02d %10.2f Bps\n", (localtime())[2,1,0],$bps;

$start_time

= [Time::HiRes::gettimeofday()];

$bytes_this_interval

= 0;

}

}

}

It's just an example, adjust to taste.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...