PxPlus User Forum
Main Board => Discussions => Programming => Topic started by: nmartinez@bristolind.com on April 03, 2023, 03:38:45 PM
-
Hi all,
Does anyone know how to PING network devices using PvxPlus (latest version)? We have used the following to see if a Windows server allows RDP, but this does not work on those servers which do not allow it..
We have used OPEN (chn, TIM=10, err=*next) "[tcp]IPaddress;tcp-portnum
Thank you!
-
The OS ping command is available on pretty much all platforms so you should be able to use that.
If however you want to see if you can RDP to a host you likely could try:
OPEN (hfn,tim=5,err=NoRDP) "[tcp]IPaddress;3389"
3389 is the standard RDP port.
-
Hi Mike,
I was hoping to get some sample PVXPlus code showing how the ping command is executed via PXPlus and how to read results to determine if successful or not..
Thx!
-
What PING command are you referencing?
The only thing related to a PING command that PxPlus has is a built-in keep alive for WindX workstations. It is basically a timer internal in the EXE that after the pre-determined interval causes the system to a dummy message to the workstation. If the message is not acknowledged prior the next transmission we assume the connection is lost.
As for pinging servers to see if they are present, the standard IP setup is to send a packet of data to port 7 of a server which should in turn echo it back. So basically an OPEN of the server port 7. use WRITE RECORD to send some data (generally around 32-64 bytes) followed by a READ RECORD which should receive back the data sent.
-
Does this look ok?
0010 BEGIN
0020 OPEN (1,TIM=5,ERR=*NEXT)"[wdx][tcp]192.168.77.230;7"
0030 WRITE RECORD (1,KEY="CHECKING IF PING COMMAND WORKS")
0040 READ RECORD (1)A$
0050 PRINT A$
-
the goal of the sample code above is to ping server with IP address 192.168.77.230 and try go see if ping is able to get any responses from it...
-
You shouldn't use the KEY=...
0010 BEGIN
0020 OPEN (1,TIM=5,ERR=BAD_HOST)"[wdx][tcp]192.168.77.230;7"
0030 WRITE RECORD (1) "CHECKING IF PING COMMAND WORKS"
0040 READ RECORD (1)A$
0050 PRINT A$
And I assume you are trying to see if the workstation can connect to the host -- thus the [wdx] prefix.
-
I am getting an error #14 when running the sample code.. I have attached a screenshot showing the code, error and ping from the command line from Windows computer I am using to ping the server with IP address 192.168.77.230..
-
That may be because the ECHO service is not running on the machine you are connecting to.
Here is a link to a discussion about using the ECHO service and the 'ping' command that may explain what you are seeing.
https://networkengineering.stackexchange.com/questions/37896/ping-port-number