<< Click to Display Table of Contents >> Navigation: 3. Script Language > Internet and Network > IPI./NPI. - If Ping |
MiniRobotLanguage (MRL)
IPI. Conditional Statement
If PING: Internet Connectivity and Web Server Availability Check
Intention
The "IPI. / NPI." command is your personal digital postman, capable of delivering a network check-up note, or "Ping", straight to a particular IP address. It's like asking, "Hey, can we connect?" to that specific address.
Once you've sent off your digital postman, you'll find his speedy response time— the "Ping-Time" —noted in milliseconds (ms) on the TOS. It's a handy way to keep track of the speed at which your messages are being delivered.
You have the option to set a deadline, or "Timeout", for the postman to return. This is your second parameter. Think of it as telling your postman, "If you don't get back in this much time, just come back home." The standard waiting time is 1000 ms.
In some cases, your digital postman might not return or might take longer than the specified time. In such situations, you'll find a -1 waiting on TOS. It's as if the postman left a note saying, "Sorry, couldn't deliver your message."
Here's a simple way to send out your digital postman using the IPI. command:
IPI.217.160.0.126
MBX.Can connect to IP
ELS.
MBX.Can not connect to IP
EIF.
POP.$$RES
MBX.Pingtime: $$RES ms.
ENR.
Upon successful establishment of a connection with any of these sites, the command returns the Ping-Time on the top of the stack (TOS), otherwise in case the Pingtime is higher or the IP Adress can not be reached, -1 will be on TOS.
Syntax
IPI.P1[|P2]
Parameter Explanation
P1 - IP-Adress
P2 - (opt) maximum Ping-Time
Always ensure to provide a valid IP-Adress in the Format IPv4.
If there is no valid IP-Adress the IPI.-Command will Ping to 127.0.0.1
The TOS will contain the resulting Ping-Time or -1 in case of error/Timeout.
Example
'**********************************************
' NPI. - Sample
'**********************************************
$$IPA=217.160.0.126
IPI.$$IPA
MBX.Can connect to IP
ELS.
MBX.Can not connect to IP
EIF.
POP.$$RES
MBX.Pingtime: $$RES ms.
ENR.
Remarks
Always ensure to provide a valid IP-Adress.
If there is no valid IP-Adress the IPI.-Command will Ping to 127.0.0.1
The Command will also set and clear the "Timeout-Flag" depending on the Result.
Limitations:
-
See also: