Jump to content

To monitor your internet connection?


huldu
 Share

Recommended Posts

Is there a way to monitor your connection using autoit to see your current download and upload speed on a selected network device?

Ive tried several bandwidth monitoring software but noone that is just *simple* so i thought might aswell try make my own. Ive try searched the forum for topics on this but having troubles find one for this problem. Note im not interesting in seeing your actual "top" download and upload speed. Just trying to find a way to monitor your connection. In windows you have netstat which tells you how much traffic has gone in and out from your computer but still not what im looking for.

Maybe it isnt possible, i wouldnt know so thats why im asking. Looked thru the helpfile for this specific thing but nothing found.

The idea to this small application would just be to show your current download and upload speed in a small window. Later this information would be logged so you can see how much you downloaded during a day, week, month, year and so on.

If anyone know someone who have successfully made an autoit code that can show your bandwidth info (as in your current download/upload speed) please link me to it :P

"I'm paper, rock is fine, nerf scissors!!!"

Link to comment
Share on other sites

I'm not sure what your tastes are for for a Download/Upload Meter program, but best I have seen is perhaps DU Meter but it is shareware. A free program that is almost a clone of DU Meter is Net Meter. Once you look through either of them, a lot of options and data information is at hand. If not suitable for your cause, then perhaps they may inspire you into making an AutoIt script based on some of their features. Definitely have a look at NetMeter if you have not tried it before.

:P

Link to comment
Share on other sites

The whole idea was to make one in autoit, not find something already made, because theres ton of them. Personally the best one ive tried is bandwidth monitor 2.9. Back to topic, the thing is why say "you can do this by using this and that program" when the whole point was to make it in autoit.

Reading the responses i dont know if some of you were just being sarcastic or just cant read. Might aswell save me and yourself time by saying "it cant be done".

"didnt read all but To monitor your internet connection you could easly go Start > Run > Cmd > Ipconfig /all"

Have you ever used ipconfig? if you have then you know it wont tell you anything about your upload/download speed.

"If you have Windows XP, open the Task Manager and click on the last tab: Networking. It produces a nice real-time graph and it's very simple."

Same as above. This only shows you your total use of your connection, quite irrelevant.

The closest thing you can come to "look" at your bandwidth using cmd is netstat (probably). Isnt this the main reason why we create programs in the first place? to make improvements, make something new, make something useful and so on.

Edited by huldu

"I'm paper, rock is fine, nerf scissors!!!"

Link to comment
Share on other sites

Reading the responses i dont know if some of you were just being sarcastic or just cant read. Might aswell save me and yourself time by saying "it cant be done".

Well, since you asked so nicely, here you go:

#include <GUIConstants.au3>

GUICreate("Lod3n's Bandwidth Monitor",220,100,0,0,-1,$WS_EX_TOOLWINDOW)

$label1 = GUICtrlCreateLabel ( "Waiting for data...", 10, 5,200,20)
$progressbar1 = GUICtrlCreateProgress (10,20,200,20,$PBS_SMOOTH)

$label2 = GUICtrlCreateLabel ( "Waiting for data...", 10, 50,200,20)
$progressbar2 = GUICtrlCreateProgress (10,65,200,20,$PBS_SMOOTH)

GUISetState ()

$wbemFlagReturnImmediately = 0x10
$wbemFlagForwardOnly = 0x20
$colItems = ""
$strComputer = "localhost"
$objWMIService = ObjGet("winmgmts:\\" & $strComputer & "\root\CIMV2")

$inmax = 0
$outmax = 0

$lastin = 0
$lastout = 0

while 1
    ;$colItems = $objWMIService.ExecQuery("SELECT BytesReceivedPersec,BytesSentPersec FROM Win32_PerfFormattedData_Tcpip_NetworkInterface", "WQL", $wbemFlagReturnImmediately + $wbemFlagForwardOnly)
    $colItems = $objWMIService.ExecQuery("SELECT BytesReceivedPersec,BytesSentPersec FROM Win32_PerfRawData_Tcpip_NetworkInterface", "WQL", $wbemFlagReturnImmediately + $wbemFlagForwardOnly)
    
    If IsObj($colItems) then
        For $objItem In $colItems
            $newin = $objItem.BytesReceivedPersec
            $newout = $objItem.BytesSentPersec
            
            ;new realtime counter code...
            if $lastin = 0 and $lastout = 0 Then
                $lastin = $newin
                $lastout = $newout
            endif
            $in = $newin - $lastin
            $out = $newout - $lastout
            $lastin = $newin
            $lastout = $newout

            if $in <> 0 and $out <> 0 Then
                if $in > $inmax then $inmax = $in
                if $out > $outmax then $outmax = $out
                
                $inP = int(($in / $inmax) * 100)
                $outP = int(($out / $outmax) * 100)
                ;$in = $in/1024
                ;$out = $out/1024           
                $intext = "Bytes In/Sec: " & int($in) & " [" &$inP & "% of record]" & @CRLF
                $outtext = "Bytes Out/Sec: " & int($out) & " [" &$outP & "% of record]" &@CRLF

                GUICtrlSetData ($progressbar1,$inP)
                GUICtrlSetData ($label1,$intext)
                GUICtrlSetData ($progressbar2,$outP)
                GUICtrlSetData ($label2,$outtext)
                
            EndIf
            ExitLoop ; I only care about the first network adapter, yo
        Next
    EndIf
   sleep(1000) ; bytes PER SECOND
   If GUIGetMsg() = $GUI_EVENT_CLOSE Then ExitLoop
WEnd

[font="Fixedsys"][list][*]All of my AutoIt Example Scripts[*]http://saneasylum.com[/list][/font]

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...