Gillboss Posted July 6, 2008 Share Posted July 6, 2008 i use this script for check ping:Dim $a=0 $target=InputBox ("Pinger", "Enter ping target: ") if $target="" then Exit endif for $g=1 to 5 $pong = Ping ($target,250) If @error = 0 Then Msgbox(0,"Ping " & $g & " of 5","Response from " & $target & " in "& $pong & " ms",1) elseif @error = 1 Then Msgbox(0,"Ping " & $g & " of 5", $target & " is offline",1) elseif @error = 2 Then Msgbox(0,"Ping " & $g & " of 5", $target & " is unreachable",1) elseif @error = 3 Then Msgbox(0,"Ping " & $g & " of 5", $target & " is a bad destination",1) Else Msgbox(0,"Ping " & $g & " of 5", "Unknown error encountered",1) EndIf $a=$pong + $a next Msgbox (4096, "Results", "Average roundtrip time: " & $a / 5 & " ms")but for this sites i get "Unknown error encountered":http://www.cast-tv.biz/play/wvx/22540/90FM_3297_IL.wvxmms://213.8.138.13/91fmhttp://switch3.castup.net/cunet/gm.asp?clipmediaid=30795http://radio.coolsite.co.il/glz.asxhttp://radio.coolsite.co.il/bet.phphttp://www.cast-tv.biz/play/wvx/22659/383_5457.wvxhttp://212.143.230.68:5555/what can i do for check this site's ping?thanks! Link to comment Share on other sites More sharing options...
Gillboss Posted July 6, 2008 Author Share Posted July 6, 2008 any? Link to comment Share on other sites More sharing options...
AlmarM Posted July 6, 2008 Share Posted July 6, 2008 Hello, Try: cast-tv.bix 213.8.138.19 switch3.castup.net radio.coolsite.co.il radio.coolsite.co.il cast-tv.biz 212.143.230.68 All sites without http:// muttley -AlmarM- Minesweeper A minesweeper game created in autoit, source available. _Mouse_UDF An UDF for registering functions to mouse events, made in pure autoit. 2D Hitbox Editor A 2D hitbox editor for quick creation of 2D sphere and rectangle hitboxes. Link to comment Share on other sites More sharing options...
AlmarM Posted July 6, 2008 Share Posted July 6, 2008 I tested them: cast-tv.biz = Response 213.8.138.19 = offline switch3.castup.net = offline 212.143.230.68 = Respone -AlmarM- Minesweeper A minesweeper game created in autoit, source available. _Mouse_UDF An UDF for registering functions to mouse events, made in pure autoit. 2D Hitbox Editor A 2D hitbox editor for quick creation of 2D sphere and rectangle hitboxes. Link to comment Share on other sites More sharing options...
Marcuzzo18 Posted July 7, 2008 Share Posted July 7, 2008 (edited) http://switch3.castup.net/cunet/gm.asp?clipmediaid=30795 actually opens winamp on my Machine...you should not ping a url or a link... you ping a HOST.. which in this case would be a domain namelooking the Link: http://switch3.castup.net/cunet/gm.asp?clipmediaid=30795the domain name would be http://switch3.castup.net/ piging this host would give me @error = 4removing the header: switch3.castup.net would show offline..infact... enter that domain name in your browser with or without the http:// you get:Directory Listing DeniedThis Virtual Directory does not allow contents to be listed.I have tried this with ConsoleWrite(_ping("switch3.castup.net")); test 1 ConsoleWrite(_ping("http://switch3.castup.net")); test 2 ConsoleWrite(_ping("192.168.0.1")); router connectivity and SRT check Func _ping($host) $var = Ping($host,250) If $var Then Return $var & "/ms"& @CRLF Switch @error Case 1 Return "Host is offline" & @CRLF Case 2 Return "Host is unreachable"& @CRLF Case 3 Return "Bad destination"& @CRLF Case 4 Return "Other errors"& @CRLF EndSwitch EndFuncOutput:Host is offline Other errors 1/mslooks like its not meant to be pinged in the first placemost host in your list look like radiostations and other streaming stuff... what are you up to my friend... muttleyI hope this info is of any use to youcheers Edited July 7, 2008 by Marcuzzo18 [font="Century Gothic"]quisnam est quantum stultus , balatro vel balatro quisnam insistovolubilis in solum rideo risi risum----------------------------------------------------------------------------------------------------------------------------Portable Command Line Tool[/font] Link to comment Share on other sites More sharing options...
Gillboss Posted July 7, 2008 Author Share Posted July 7, 2008 i have radio player, and i have to check if station adress online.. if i will not have it, users will think script have problem.. Link to comment Share on other sites More sharing options...
FreeFry Posted July 7, 2008 Share Posted July 7, 2008 (edited) Even tho ping should not be used to see if the computer is online or not, I would more rely on several pings, which I whipped up this tiny function for:$avgPing = _Ping("www.google.com", 500, 30) ConsoleWrite("Error Count: " & @error & @TAB & "Average ping: " & @extended & @LF) For $i = 1 To UBound($avgPing)-1 ConsoleWrite("Ping #" & $i & " : " & $avgPing[$i][0] & " Error: " & $avgPing[$i][1] & @LF) Next Func _Ping($svHost, $ivTimeOut = 1000, $ivTries = 4, $ivSleepTime = 1000) Local $avPing[$ivTries+1][2] = [[0]], $ivDivider = 0 For $i = 1 To $ivTries $avPing[$i][0] += Ping($svHost, $ivTimeOut) $avPing[$i][1] = @error $avPing[0][0] += $avPing[$i][0] If $avPing[$i][1] Then $avPing[0][1] += 1 $ivDivider += (Not $avPing[$i][1]) Sleep($ivSleepTime) Next Return(SetError($avPing[0][1], Int($avPing[0][0]/$ivDivider), $avPing)) EndFuncStores average ping in @extended, and sets @error to the number of failed attempts, and also returns an array containing the result of each ping, and number of errors, and the average ping.$array[0][0] = average ping$array[0][1] = number of errors$array[x][0] = Ping #x$array[x][1] = @error for ping #xEdit:Fixed a problem where an error in one of the pings would cause the average ping to drop.Edit2:Added another parameter to be able to specify the newly added Sleep in the loop($ivSleepTime). Edited July 11, 2008 by FreeFry Link to comment Share on other sites More sharing options...
Gillboss Posted July 7, 2008 Author Share Posted July 7, 2008 (edited) so can check if station radio online or no? maybe can i try with IE functions.. but seem hard Edited July 7, 2008 by Gillboss Link to comment Share on other sites More sharing options...
FreeFry Posted July 8, 2008 Share Posted July 8, 2008 Depends if the radio station has ping activated on their server/router. I know some computer doesn't, so Ping is not viable for detecting online status. But otherwise, perhaps you can try with TCPConnect ? Link to comment Share on other sites More sharing options...
Gillboss Posted July 9, 2008 Author Share Posted July 9, 2008 so can i know if adress online or offline? Link to comment Share on other sites More sharing options...
FreeFry Posted July 9, 2008 Share Posted July 9, 2008 Yes... As I said, try using TCPConnect on the host, and if it times out, it might be down... Link to comment Share on other sites More sharing options...
Gillboss Posted July 9, 2008 Author Share Posted July 9, 2008 im new at this function.. what write at port? Link to comment Share on other sites More sharing options...
FreeFry Posted July 9, 2008 Share Posted July 9, 2008 Well, if it's the website you want to check if it's up, it's either 80, or 8080(most probably 80), if it's the radio, then you'll have to look in whatever program that you connect to the radio with, for which port it connects to. Most probably, checking if the website is up should be sufficient. Link to comment Share on other sites More sharing options...
Gillboss Posted July 9, 2008 Author Share Posted July 9, 2008 not work.. =\ ;CLIENT!!!!!!!! Start SERVER First... dummy!! $g_IP = "http://www.cast-tv.biz/play/wvx/22659/383_5457.wvx" ; Start The TCP Services ;============================================== TCPStartUp() ; Connect to a Listening "SOCKET" ;============================================== $socket = TCPConnect( $g_IP, 80 ) MsgBox(0, "", $socket) Link to comment Share on other sites More sharing options...
FreeFry Posted July 10, 2008 Share Posted July 10, 2008 I think you need to re-read this thread, it has already been explained that the address contains the host-name/ip, which you need to "extract" from the address... Link to comment Share on other sites More sharing options...
rasim Posted July 10, 2008 Share Posted July 10, 2008 not work.. =\ ;CLIENT!!!!!!!! Start SERVER First... dummy!! $g_IP = "http://www.cast-tv.biz/play/wvx/22659/383_5457.wvx" ; Start The TCP Services ;============================================== TCPStartUp() ; Connect to a Listening "SOCKET" ;============================================== $socket = TCPConnect( $g_IP, 80 ) MsgBox(0, "", $socket)oÝ÷ Ûú®¢×¢éÞyÛhrïz»ljr'µêçzÙÚëh öv·¬±«¢+ÙQ AMÑÉÑUÀ ¤((ÀÌØí%¹Ñ9µôÅÕ½ÐíÝÝܹ½½±¹½´ÅÕ½Ðì((ÀÌØí}%@ôQ A9µQ½%@ ÀÌØí%¹Ñ9µ¤((ÀÌØíͽÐôQ A ½¹¹Ð ÀÌØí}%@°àÀ¤)5Í ½à À°ÅÕ½ÐìÅÕ½Ðì°ÀÌØíͽФ()Q AM¡Õѽݸ ¤ Link to comment Share on other sites More sharing options...
Gillboss Posted July 10, 2008 Author Share Posted July 10, 2008 (edited) ok, and its not work...: TCPStartUp() $InetName = "http://radio.coolsite.co.il/glz.asx" $g_IP = TCPNameToIP($InetName) $socket = TCPConnect($g_IP, 80) MsgBox(0, "", $socket) TCPShutdown ( ) hmm u know if: WMOpenFile($URL) or WMPlay($URL) return somthing? Edited July 10, 2008 by Gillboss Link to comment Share on other sites More sharing options...
FreeFry Posted July 10, 2008 Share Posted July 10, 2008 (edited) ok, and its not work...: TCPStartUp() $InetName = "http://radio.coolsite.co.il/glz.asx" $g_IP = TCPNameToIP($InetName) $socket = TCPConnect($g_IP, 80) MsgBox(0, "", $socket) TCPShutdown ( ) hmm u know if: WMOpenFile($URL) or WMPlay($URL) return somthing?Someone's a little slow muttley TCPStartUp() $InetName = "radio.coolsite.co.il" $g_IP = TCPNameToIP($InetName) $socket = TCPConnect($g_IP, 80) MsgBox(0, $g_IP, $socket) TCPShutdown() Exit You can't use an address like that to connect to with functions like TCPConnect, Ping, etc. You need to extract the hostname from it(and as in the case with TCPConnect, you need to resolve the hostname to an ip-address, with TCPNameToIP) Edited July 10, 2008 by FreeFry Link to comment Share on other sites More sharing options...
Gillboss Posted July 10, 2008 Author Share Posted July 10, 2008 (edited) thx but it's not good for me, i never know the address, there is too much addresses..for example:http://www.cast-tv.biz/play/wvx/22540/90FM_3297_IL.wvxhttp://radio.coolsite.co.il/glz.asxhttp://radio.coolsite.co.il/bet.phphttp://212.143.230.68:5555/and more..i think IE Create can help.. Edited July 10, 2008 by Gillboss Link to comment Share on other sites More sharing options...
FreeFry Posted July 11, 2008 Share Posted July 11, 2008 I don't see what the problem is, Just use StringReplace, and/or StringLeft combined with StringInStr to extract the hostname, then you're good to go.. Example: TCPStartup() Dim $address = "http://www.cast-tv.biz/play/wvx/22540/90FM_3297_IL.wvx" ; Remove http:// part $hostname = StringReplace($address, "http://", "") ;Extract the hostname from the rest of the address: $hostname = StringLeft($hostname, StringInStr($hostname, "/")-1) MsgBox(0, "Hostname: " & $hostname, "Ip-address: " & TCPNameToIP($hostname)) TCPShutdown() 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