none
Calculate internet download speed and upload speed

    Question

  • Hi
    i want to monitor the speed at which my system is currently Downloading and uploading. I dont have any idea how will it can be done.
    Wednesday, July 29, 2009 11:08 AM

Answers

  • So do you want to create a net monitoring tool like that created with CISCO?

    Network Monitor Pro (CISCO)


    This walk-through might be a start:

    Bandwidth Monitor using VB

    Get Internet Connection Speed

    Hope this helps

    Cheers



    Waleed El-Badry Teaching Assistant Faculty of Engineering Misr University for Science & Technology
    • Proposed as answer by Waleed El-Badry Wednesday, July 29, 2009 1:45 PM
    • Marked as answer by Faraz Zone Saturday, August 01, 2009 3:38 AM
    Wednesday, July 29, 2009 1:33 PM


  • Upload, Download speed

    Put 4 Texboxes and a timer on your form



    Option Strict On
    Imports System.IO
    Public Class Form1
    
        'Textbox1: Download Speed ( Bytes/sec )
        'Textbox2: Upload Speed ( Bytes/sec )
        'Textbox3: Maximum Download Speed ( Bytes/sec )
        'Textbox4: Maximum Upload Speed ( Bytes/sec )
    
        Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
            Timer1.Interval = 1000
            Timer1.Start()
            Me.TopMost = True
            TextBox1.Text = "Warming up"
            TextBox2.Text = "Warming up"
            TextBox3.Text = "0"
            TextBox4.Text = "0"
            If Not Directory.Exists("C:\temp") Then
                Directory.CreateDirectory("C:\temp")
            End If
        End Sub
    
        Dim LDown As Integer
        Dim LUp As Integer
        Dim MDown As Integer
        Dim MUp As Integer
        Dim First As Boolean = True
    
        Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
    
            If My.Computer.Network.IsAvailable Then
                Try
                    Dim sr As StreamReader = New StreamReader("C:\temp\BandWidth.Val")
                    Dim line As String = ""
                    For x As Integer = 1 To 5
                        line = sr.ReadLine()
                    Next
                    Dim DownString As String = line.Substring(8, 28).Trim
                    If Not First Then
                        TextBox1.Text = Format((CInt(DownString) - LDown), "##,##0")
                        If (CInt(DownString) - LDown) > CInt(TextBox3.Text) Then
                            MDown = CInt(DownString) - LDown
                            TextBox3.Text = Format(MDown, "##,##0")
                        End If
                    End If
                    LDown = CInt(DownString)
                    Dim UpString As String = line.Substring(36, line.Length - 36).Trim
                    If Not First Then
                        TextBox2.Text = Format((CInt(UpString) - LUp), "##,##0")
                        If (CInt(UpString) - LUp) > CInt(TextBox4.Text) Then
                            MUp = CInt(UpString) - LUp
                            TextBox4.Text = Format(MUp, "##,##0")
                        End If
                    End If
                    First = False
                    LUp = CInt(UpString)
                    sr.Close()
                Catch ex As Exception
                End Try
            Else
                TextBox1.Text = "No Connection"
                TextBox2.Text = "No Connection"
            End If
            Shell("cmd.exe /C netstat -e> " & Chr(34) & "C:\temp\BandWidth.Val" & Chr(34), vbHide)
        End Sub
    
    End Class
    • Edited by Crazypennie Wednesday, July 29, 2009 9:27 PM
    • Marked as answer by Faraz Zone Saturday, August 01, 2009 3:37 AM
    Wednesday, July 29, 2009 9:24 PM

All replies

  • Hello Faraz,
    This is a great resource to do your project:

    Downloading Files in .NET with Information

    This is also a code snippet you may use for uploading/downloading files using My Namespace:
    'Check if web site is reachable
    If My.Computer.Network.Ping("www.anywebsite.com", 1000) Then
      		MsgBox("Server pinged successfully.")
    	Else
      		MsgBox("Ping request timed out.")
    	End If
    
    	'Download a file
            My.Computer.Network.DownloadFile _
        	("http://www.anywebsite.com/downloads/anyfile.txt", _
        	"C:\Documents\anyfile.txt")
    
            'Upload a file
    	My.Computer.Network.UploadFile( _
    	"C:\Documents\anyfile.txt", _
    	"http://www.anywebsite.com/uploads/")
    


    Cheers


    Waleed El-Badry Teaching Assistant Faculty of Engineering Misr University for Science & Technology
    Wednesday, July 29, 2009 1:01 PM
  • Hi
    This is good for download manger but i am looking for a monitoring system which will tell me on which speed my computer is using internet weather the files are downloaded from other download manger or web browser.
    Wednesday, July 29, 2009 1:26 PM
  • So do you want to create a net monitoring tool like that created with CISCO?

    Network Monitor Pro (CISCO)


    This walk-through might be a start:

    Bandwidth Monitor using VB

    Get Internet Connection Speed

    Hope this helps

    Cheers



    Waleed El-Badry Teaching Assistant Faculty of Engineering Misr University for Science & Technology
    • Proposed as answer by Waleed El-Badry Wednesday, July 29, 2009 1:45 PM
    • Marked as answer by Faraz Zone Saturday, August 01, 2009 3:38 AM
    Wednesday, July 29, 2009 1:33 PM


  • Upload, Download speed

    Put 4 Texboxes and a timer on your form



    Option Strict On
    Imports System.IO
    Public Class Form1
    
        'Textbox1: Download Speed ( Bytes/sec )
        'Textbox2: Upload Speed ( Bytes/sec )
        'Textbox3: Maximum Download Speed ( Bytes/sec )
        'Textbox4: Maximum Upload Speed ( Bytes/sec )
    
        Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
            Timer1.Interval = 1000
            Timer1.Start()
            Me.TopMost = True
            TextBox1.Text = "Warming up"
            TextBox2.Text = "Warming up"
            TextBox3.Text = "0"
            TextBox4.Text = "0"
            If Not Directory.Exists("C:\temp") Then
                Directory.CreateDirectory("C:\temp")
            End If
        End Sub
    
        Dim LDown As Integer
        Dim LUp As Integer
        Dim MDown As Integer
        Dim MUp As Integer
        Dim First As Boolean = True
    
        Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
    
            If My.Computer.Network.IsAvailable Then
                Try
                    Dim sr As StreamReader = New StreamReader("C:\temp\BandWidth.Val")
                    Dim line As String = ""
                    For x As Integer = 1 To 5
                        line = sr.ReadLine()
                    Next
                    Dim DownString As String = line.Substring(8, 28).Trim
                    If Not First Then
                        TextBox1.Text = Format((CInt(DownString) - LDown), "##,##0")
                        If (CInt(DownString) - LDown) > CInt(TextBox3.Text) Then
                            MDown = CInt(DownString) - LDown
                            TextBox3.Text = Format(MDown, "##,##0")
                        End If
                    End If
                    LDown = CInt(DownString)
                    Dim UpString As String = line.Substring(36, line.Length - 36).Trim
                    If Not First Then
                        TextBox2.Text = Format((CInt(UpString) - LUp), "##,##0")
                        If (CInt(UpString) - LUp) > CInt(TextBox4.Text) Then
                            MUp = CInt(UpString) - LUp
                            TextBox4.Text = Format(MUp, "##,##0")
                        End If
                    End If
                    First = False
                    LUp = CInt(UpString)
                    sr.Close()
                Catch ex As Exception
                End Try
            Else
                TextBox1.Text = "No Connection"
                TextBox2.Text = "No Connection"
            End If
            Shell("cmd.exe /C netstat -e> " & Chr(34) & "C:\temp\BandWidth.Val" & Chr(34), vbHide)
        End Sub
    
    End Class
    • Edited by Crazypennie Wednesday, July 29, 2009 9:27 PM
    • Marked as answer by Faraz Zone Saturday, August 01, 2009 3:37 AM
    Wednesday, July 29, 2009 9:24 PM
  • How would you make  bytes/sec into kbps/sec .

    Saturday, October 03, 2009 1:28 PM
  • 1 Kbit =1024 bits
    1 Byte = 8 bits

    So:

    ValueInKbits=(ValueInBytes*8)/1024

    Cheers

    Waleed El-Badry ,Teaching Assistant, Faculty of Engineering , Misr University for Science & Technology
    Saturday, October 03, 2009 1:33 PM