Jump to content


Check out our Community Blogs

Register and join over 40,000 other developers!


Recent Status Updates

View All Updates

Photo
- - - - -

How to create a Bandwidth Monitor

timer

  • Please log in to reply
47 replies to this topic

#13 Guest_Jordan_*

Guest_Jordan_*
  • Guest

Posted 14 September 2008 - 06:47 AM

Nice tutorial Dren! I've awarded you points for the contest so I won't be giving you +rep (otherwise I would).
  • 0

#14 Dren

Dren

    CC Addict

  • Just Joined
  • PipPipPipPipPip
  • 232 posts

Posted 14 September 2008 - 07:21 AM

Thank you Jordan, this is making me keep supporting CodeCall with tutorials :)

Thanks again,
Dren
  • 0

#15 Guest_Jordan_*

Guest_Jordan_*
  • Guest

Posted 14 September 2008 - 07:25 AM

Great! I'd love to see more tutorials. Post as many as you like and PM me with the link (for contest points).
  • 0

#16 amrosama

amrosama

    CC Mentor

  • VIP Member
  • PipPipPipPipPipPipPipPip
  • 2765 posts

Posted 14 September 2008 - 07:28 AM

Thats the spirit
Posted via CodeCall Mobile
  • 0

#17 alisaltech

alisaltech

    CC Lurker

  • Just Joined
  • Pip
  • 1 posts

Posted 25 September 2008 - 05:15 PM

Nice tutorial, had a few issues getting it to run, but all ended well. :)
  • 0

#18 Speedular

Speedular

    CC Newcomer

  • Just Joined
  • PipPip
  • 13 posts

Posted 26 September 2008 - 11:31 PM

I really liked the tutorial, thnkx dude
  • 0

#19 marwex89

marwex89

    CC Mentor

  • VIP Member
  • PipPipPipPipPipPipPipPip
  • 2857 posts

Posted 27 September 2008 - 06:07 PM

Great tutorial! +rep!
  • 0
Hey! Check out my new Toyota keyboaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa

#20 MXTECH

MXTECH

    CC Regular

  • Just Joined
  • PipPipPip
  • 46 posts

Posted 27 September 2008 - 08:32 PM

Public Sub GetLoadInfo()
        Dim TempLoadStr As String
        Dim LoadStr As String

        Shell("cmd.exe /C netstat -e> " & Chr(34) & Application.StartupPath & "\Load.tmp" & Chr(34), vbHide)

        On Error GoTo PassRead [B][U]Open Application.StartupPath & "\Load.tmp" For Input As #1[/U][/B]

        Do Until EOF(1)
        Input [B][U]#[/U][/B]1, TempLoadStr
            LoadStr = LoadStr & TempLoadStr
        Loop [B][U]Close[/U][/B] #1

       [B][U] sString[/U][/B] = Split(LoadStr, "Bytes")

        DLoad = Int(Mid([B][U]SString[/U][/B](1), 14, 17))
        ULoad = Int(Mid([B][U]SString[/U][/B](1), 31, 16))

PassRead:
    End Sub
this part is giving me errors dude :( man i really wanna get this working cos it looks cool, i'm using Visual Studio 2008 if that helps, i tried importing your project and some "TODO" gave me 96 errors,
the bolded areas of the code are the errors VS is giving me
  • 0

#21 MXTECH

MXTECH

    CC Regular

  • Just Joined
  • PipPipPip
  • 46 posts

Posted 27 September 2008 - 08:32 PM

This is all the code i have in it:
Option Strict Off
Option Explicit On
Public Class Form1
    Public ULoad As Long
    Public DLoad As Long
    Dim LastDLoad As Integer
    Dim LastULoad As Integer
    Dim SecondsPassed As Integer
    Dim DR(9) As Short
    Dim UR(9) As Short

    Public Sub GetLoadInfo()
        Dim TempLoadStr As String
        Dim LoadStr As String

        Shell("cmd.exe /C netstat -e> " & Chr(34) & Application.StartupPath & "\Load.tmp" & Chr(34), vbHide)

        On Error GoTo PassRead Open Application.StartupPath & "\Load.tmp" For Input As #1

        Do Until EOF(1)
        Input #1, TempLoadStr
            LoadStr = LoadStr & TempLoadStr
        Loop Close #1

        sString = Split(LoadStr, "Bytes")

        DLoad = Int(Mid(SString(1), 14, 17))
        ULoad = Int(Mid(SString(1), 31, 16))

PassRead:
    End Sub

    Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
        Call GetLoadInfo()

        If SecondsPassed > 3 Then
            lblDC.Text = Int((DLoad - LastDLoad) / 1000) * 8 & "kb/s"
            lblUC.Text = Int((ULoad - LastULoad) / 1000) * 8 & "kb/s"
        End If

        SecondsPassed = SecondsPassed + 1

        LastDLoad = DLoad
        LastULoad = ULoad
    End Sub
End Class

  • 0

#22 Dren

Dren

    CC Addict

  • Just Joined
  • PipPipPipPipPip
  • 232 posts

Posted 10 October 2008 - 01:39 PM

The code is for VB6, not for .NET :mellow:
  • 0

#23 RadioRaiders

RadioRaiders

    CC Lurker

  • Just Joined
  • Pip
  • 1 posts

Posted 24 October 2008 - 03:01 AM

Thanks! I will download this and test it tonight! (I have to have 1 post before I can download, so this is it! :P)
  • 0

#24 MathX

MathX

    CC Leader

  • Expert Member
  • PipPipPipPipPipPipPip
  • 1038 posts
  • Programming Language:Java

Posted 24 October 2008 - 03:27 AM

Attached Files dont work.....Is there a problem with the attachment or what?
  • 0





Also tagged with one or more of these keywords: timer

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download