Sign in to follow this  
Followers 0
Gillboss

Check Ping

26 posts in this topic

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.wvx

mms://213.8.138.13/91fm

http://switch3.castup.net/cunet/gm.asp?clipmediaid=30795

http://radio.coolsite.co.il/glz.asx

http://radio.coolsite.co.il/bet.php

http://www.cast-tv.biz/play/wvx/22659/383_5457.wvx

http://212.143.230.68:5555/

what can i do for check this site's ping?

thanks!

Share this post


Link to post
Share on other sites



any?

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

#5 ·  Posted (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 name

looking the Link: http://switch3.castup.net/cunet/gm.asp?clipmediaid=30795

the domain name would be http://switch3.castup.net/

piging this host would give me @error = 4

removing 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 Denied

This 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
EndFunc

Output:

Host is offline
Other errors
1/ms

looks like its not meant to be pinged in the first place

most host in your list look like radiostations and other streaming stuff... what are you up to my friend... muttley

I hope this info is of any use to you

cheers

Edited by Marcuzzo18

[font="Century Gothic"]quisnam est quantum stultus , balatro vel balatro quisnam insistovolubilis in solum rideo risi risum----------------------------------------------------------------------------------------------------------------------------Portable Command Line Tool[/font]

Share this post


Link to post
Share on other sites

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..

Share this post


Link to post
Share on other sites

#7 ·  Posted (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))
EndFunc

Stores 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 #x

Edit:

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 by FreeFry

Share this post


Link to post
Share on other sites

#8 ·  Posted (edited)

so can check if station radio online or no?

maybe can i try with IE functions.. but seem hard

Edited by Gillboss

Share this post


Link to post
Share on other sites

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 ?

Share this post


Link to post
Share on other sites

so can i know if adress online or offline?

Share this post


Link to post
Share on other sites

Yes... As I said, try using TCPConnect on the host, and if it times out, it might be down...

Share this post


Link to post
Share on other sites

im new at this function.. what write at port?

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

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)

Share this post


Link to post
Share on other sites

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...

Share this post


Link to post
Share on other sites

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¡Õѽݸ ¤

Share this post


Link to post
Share on other sites

#17 ·  Posted (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 by Gillboss

Share this post


Link to post
Share on other sites

#18 ·  Posted (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 by FreeFry

Share this post


Link to post
Share on other sites

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()

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  
Followers 0