Ping target computer


int xPCTargetPing(int port);



Enter the value returned by the function xPCOpenTcpIpPort.


If the target responds, the function returns 1. If the target computer does not respond, the function returns 0. The function does not return an error status.


The xPCTargetPing function pings the target computer and returns 1 or 0 depending on whether the target responds or not. This function returns an error character string constant only when there is an error in the input parameter. Such errors include an invalid port number or the port is not open. Other errors, such as the inability to connect to the target, are ignored.

xPCTargetPing causes the target computer to close the TCP/IP connection. You can use xPCOpenConnection to reconnect. You can also use this xPCTargetPing feature to close the target computer connection in the event of a failed connection. For example, if the program running on your development computer has a fatal error and aborts its I/O connection, you can close it.

Introduced in R2007a

Was this topic helpful?