Lokeshverma Posted December 1, 2006 Share Posted December 1, 2006 (edited) 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 December 1, 2006 by Lokeshverma Link to comment Share on other sites More sharing options...
piccaso Posted December 2, 2006 Share Posted December 2, 2006 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 Link to comment Share on other sites More sharing options...
Lokeshverma Posted December 2, 2006 Author Share Posted December 2, 2006 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 ?? Link to comment Share on other sites More sharing options...
Lokeshverma Posted December 2, 2006 Author Share Posted December 2, 2006 Ping function always gives error 4 i.e. other errors Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now