Jump to content
Sign in to follow this  
Lokeshverma

Proxy Checker

Recommended Posts

Lokeshverma

I have used TCPConnect to find out fastest proxy out of those written in a .ini file ,

I'm not quit sure if this code is 100% correct , but still now I have a problem.

If any of the listed proxies doesn't work ,this code takes very long time to give an output.

I tried to use Opt("TCPTimeout",100) but it didn't worked ( read from help file ;) )

Plz help me . Thanks in advance.

$proxy = IniReadSection ( "C:\proxy.ini", "1" )

$MinTime = 10000

$MinIndex = 1

for $i = 1 to $proxy[0][0] Step +1

$IP = StringLeft($proxy[$i][1],StringInStr($proxy[$i][1], ":")-1)

$Port = StringMid($proxy[$i][1],StringInStr($proxy[$i][1], ":")+1)

TCPStartup()

$begin = TimerInit()

$Socket = TCPConnect($IP,$Port)

$dif = TimerDiff($begin)

If int($dif) < int($MinTime) Then

$MinIndex = $i

$MinTime = $dif

EndIf

TCPShutdown()

Next

MsgBox (1,"Fastest Proxy",$proxy[$MinIndex][1])

Edited by Lokeshverma

Share this post


Link to post
Share on other sites
piccaso

you can set the timeout for ping...

TCPStartup()
$sIp = "1.2.3.4"; i dont work

$iTimer = TimerInit()
Ping($sIp,1500) ; Wait 1.5 sec
ConsoleWrite("Ping Time: " & TimerDiff($iTimer) & @LF)

Opt("TCPTimeout",50); I'm sure there is a reason why this has no effect at connection time...
$iTimer = TimerInit()
TCPConnect($sIp,123)
ConsoleWrite("TCPConnect Time: " & TimerDiff($iTimer) & @LF)

;~  Output:

;~  Ping Time: 1752.72080669471
;~  TCPConnect Time: 19416.9485227871

CoProc Multi Process Helper libraryTrashBin.nfshost.com store your AutoIt related files here!AutoIt User Map

Share this post


Link to post
Share on other sites
Lokeshverma

you can set the timeout for ping...

TCPStartup()
$sIp = "1.2.3.4"; i dont work

$iTimer = TimerInit()
Ping($sIp,1500) ; Wait 1.5 sec
ConsoleWrite("Ping Time: " & TimerDiff($iTimer) & @LF)

Opt("TCPTimeout",50); I'm sure there is a reason why this has no effect at connection time...
$iTimer = TimerInit()
TCPConnect($sIp,123)
ConsoleWrite("TCPConnect Time: " & TimerDiff($iTimer) & @LF)

;~  Output:

;~  Ping Time: 1752.72080669471
;~  TCPConnect Time: 19416.9485227871
I have got another problem,here ping function doesn't works !!!!

Any guesses why ??

Share this post


Link to post
Share on other sites
Lokeshverma

Ping function always gives error 4 i.e. other errors

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.