Jump to content
Sign in to follow this  
bcording

Function To Find The Fastest Server

Recommended Posts

bcording

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

Share this post


Link to post
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
Sign in to follow this  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.