Tom's Guide | Tom's Hardware | Tom's Games
![]() |
![]() |
![]() |
I want to ping a bunch of machines in my Intranet using a Rexx script. To my dismay, using the function FTPping from RXFTP.DLL does not work reliably. Any other suggestions? I'd really hate to have to send a ping to cmd and have to parse the output (unless someone already has proven code to do that.).
Thanks, Andy

I use following CMDs to do some stuff, if that helps. yo're welcome:
/* Voytek's Pinger */
/*
this application uses a ping function with the following specs:ping
Usage: ping [-?drv][size [packets]] the expected output includes the following:
----xxx.yyy.zzz.qqq PING Statistics----
10 packets transmitted, 10 packets received, 0% packet loss
round-trip (ms) min/avg/max = 30/31/40we search for these lines, and parse their results
The external command must return 4 lines of output:
Line 1 : current state of the 'incoming bytes counter'
Line 2 : current state of the 'outgoing bytes counter'
Line 3 : string, telling the uptime of the target.
Line 4 : string, telling the name of the target.
*/SIGNAL On Halt
Server= stdout('hostname') 'Ping'
Uptime=STRIP(SUBSTR(stdout('go -ut'),71))PARSE ARG Target /* Include host, size & count of pkts */
Newq=Rxqueue('Create')
'@ ping 'Target'|rxqueue'
DO While Queued() >< 0
PULL Line
IF Pos('TRANSMITTED',Line)>< 0
Then
DO
Rline = Reverse(Line)
PARSE Var Rline . . '%' Rlost .
Lost = Reverse(Rlost)
/* SAY Lost */
End /* do */
/* IF Pos('ROUND',Line)>< 0
Then
DO
Rline=Reverse(Line)
PARSE Var Rline Rmaxi '/' Ravg '/' Rmini .
Maxi=Reverse(Rmaxi) ; Avg=Reverse(Ravg) ; Mini=Reverse(Rmini)
/* SAY Maxi
SAY Mini
SAY " " */
SAY Avg
End
*/ /* do */
EndSAY Lost
SAY '0'
SAY uptime /* do */
SAY server STRIP(Target) lost '% lost packets'
HALT:
CALL Rxqueue 'Delete',Newq
EXIT
and/* Voytek's Pinger */
SIGNAL On HaltServer= stdout('hostname') 'Ping'
Uptime=STRIP(SUBSTR(stdout('go -ut'),71))PARSE ARG Target /* Include host, size & count of pkts */
Newq=Rxqueue('Create')
'@ ping 'Target'|rxqueue'DO While Queued() >< 0
PULL Line
/* do */
IF Pos('ROUND',Line)>< 0
Then
DO
Rline=Reverse(Line)
PARSE Var Rline Rmaxi '/' Ravg '/' Rmini .
Maxi=Reverse(Rmaxi) ; Avg=Reverse(Ravg) ; Mini=Reverse(Rmini)
SAY Maxi
SAY Mini
SAY uptime
/* SAY Avg */
End /* do */
End /* do */
SAY SERVER STRIP(Target) 'round-trip (ms) min/avg/max =' mini'/'avg'/'maxi
HALT:
CALL Rxqueue 'Delete',Newq
EXIT

Look excellent! I'll get around to testing and expanding it for my purposes in the next few days.
Thanks a lot.

![]() |
![]() |
![]() |

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.
| Ads by Google |