Jump to content

Function To Find The Fastest Server


bcording
 Share

Recommended Posts

This scrap will download a static file from multiple servers and determine which is the fastest. I'm using it to at work to find the fastest server for software installs. It would only be useful if your servers contained the same data. My co-workers call it the poor man's active directory. :whistle:

Global $Fastest = "Failed"
Global $Time = 32768
Global $TestFile = "\Share\512k.tmp"

TestServer("Server01")
TestServer("Server02")
TestServer("Server03")
TestServer("Server04")
TestServer("Server05")

msgbox(0,"Fastest Server:",$Fastest & " = " & $Time & " seconds")

Func TestServer($Server)
    Local $Begin, $Dif
    $Begin = TimerStart()
    If FileCopy("\\" & $Server & $TestFile, @TempDir & "\512k.tmp",1) then
        $Dif = StringFormat("%.2f" ,TimerStop($Begin) / 1000)
        If $Dif < $Time then
            $Time = $Dif
            $Fastest = $Server
            TrayTip($Server, $Dif, 30, 1)
        EndIf
    Else
        $Dif = "Failed"
    EndIF
    iniwrite("SpeedTest.ini","Speed",$Server,$Dif)
EndFunc
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...