Mehmet Posted May 16, 2016 Share Posted May 16, 2016 Arkadaşlar Edit1'e eklediğim proxyleri sırası ile internete çıkış yaptırıyorum fakat Listede internete çıkışı olmayan veya geç çıkış yapan proxy'i nasıl atlayabilirim Atıyorum 5 saniye içinde proxy cevap vermiyorsa yani internete çıkışı 5 saniye içinde gerçekleşmiyorsa diğer proxy'e atlasın istiyorum #include <Inet.au3> #include <String.au3> #include <ButtonConstants.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> $Form1 = GUICreate("Form1", 452, 282) $Edit1 = GUICtrlCreateEdit("", 32, 32, 185, 241) GUICtrlSetData(-1, "") $Button1 = GUICtrlCreateButton("Run", 320, 16, 75, 25) $Edit2 = GUICtrlCreateEdit("", 232, 88, 169, 177) GUICtrlSetData(-1, "") GUISetState(@SW_SHOW) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Button1 $aproxyread = StringSplit(GUICtrlRead($Edit1), @CR) For $aproxyadd = 1 To UBound($aproxyread) - 1 HttpSetProxy(2, $aproxyread[$aproxyadd]) GUICtrlSetData($Edit2, "Proxy: " & $aproxyread[$aproxyadd] & @CRLF & "IP: " & _IPGet()) Next EndSwitch WEnd Func _IPGet() Local Const $GETIP_TIMER = 3000 Local Static $hTimer = 0 Local Static $sLastIP = 0 If TimerDiff($hTimer) < $GETIP_TIMER And Not $sLastIP Then Return SetExtended(1, $sLastIP) EndIf Local $aGetIPURL[] = ["http://bot.whatismyipaddress.com", "http://www.myexternalip.com/raw", "http://checkip.dyndns.org"], $aReturn = 0, $sReturn = "" For $i = 1 To UBound($aGetIPURL) - 1 $sReturn = InetRead($aGetIPURL[$i]) If @error Or $sReturn == "" Then ContinueLoop $aReturn = StringRegExp(BinaryToString($sReturn), "((?:\d{1,3}\.){3}\d{1,3})", 3) If Not @error Then $sReturn = $aReturn[0] ExitLoop EndIf $sReturn = "" Next $hTimer = TimerInit() $sLastIP = $sReturn If $sReturn == "" Then Return SetError(1, 0, -1) Return $sReturn EndFunc ;==>_IPGet Proxy list 193.194.69.36:3128 189.28.166.79:80 79.120.72.222:3128 203.66.159.44:3128 200.46.94.202:3128 198.50.129.9:3128 31.173.74.73:8080 178.33.191.53:3128 47.88.15.211:10080 38.83.105.194:8118 112.199.65.190:3128 47.88.15.211:10080 64.20.48.83:8080 149.202.249.227:3128 1 Quote Link to comment Share on other sites More sharing options...
MostWanted Posted May 17, 2016 Share Posted May 17, 2016 Please register to see this content. Ping fonksiyonunu kullanabilirsin. $zaman = Ping("193.194.69.36", 5000); dersin. Eğer $zaman 0 gelirse bu host'a 5 saniye içerisinde bağlanamıyorsun anlamına gelir. @error macrosundan spesifik hatayı bile bulabilirsin. 1 Quote Link to comment Share on other sites More sharing options...
Mehmet Posted May 17, 2016 Author Share Posted May 17, 2016 @MostWanted bu fonksiyon iyi gibi görünüyor teşekkür ederim, fakat 600 ms verdiğim halde bazen hata da veriyor bu normalmidir? #include <MsgBoxConstants.au3> Global $site = "autoitscript.com" Example() Func Example() Local $iPing = Ping($site, 600) If $iPing Then MsgBox($MB_SYSTEMMODAL, "", "Erişim zamanı: " & $iPing & "ms.") Else MsgBox($MB_SYSTEMMODAL, "", "Hata ve @error değeri: " & @error) EndIf EndFunc Quote Link to comment Share on other sites More sharing options...
MostWanted Posted May 18, 2016 Share Posted May 18, 2016 Bazen proxyler offline olabiliyor. Eğer internetin de sorun oluşmuyorsa evet normaldir. Ama yine de istersen timeout süresini artırabilirsin. 1 Quote Link to comment Share on other sites More sharing options...
Administrator sk8er_boi Posted May 18, 2016 Administrator Share Posted May 18, 2016 Proxy'nin bulunduğu ip'nin pinglenebiliyor olması, proxy'nin açık olduğu anlamına gelmez. 1 Quote Link to comment Share on other sites More sharing options...
Mehmet Posted May 18, 2016 Author Share Posted May 18, 2016 7 dakika önce, sk8er_boi yazdı: Proxy'nin bulunduğu ip'nin pinglenebiliyor olması, proxy'nin açık olduğu anlamına gelmez. @sk8er_boi Ozaman proxylerin çalışıp çalışmadığını Http durum kodları ile kontrol etmek dahamı mantıklı? mesela:200,500,404 gibi.. Quote Link to comment Share on other sites More sharing options...
Administrator sk8er_boi Posted May 18, 2016 Administrator Share Posted May 18, 2016 Evet, kapalı olmayacak ve hata vermeyecek bir site üstünde deneyebilirsin. 200'den başka bir şey dönerse hatalıdır. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.