The IBM® Toolbox
for Java™ AS400JPing
class allows your Java program to query the host servers to see which
services are running and which ports are in service.
To query the servers from a command line, use the JPing class.
The
AS400JPing class provides several methods:
- Ping the server
- Ping a specific service on the server
- Set a PrintWriter object to which you want to log ping information
- Set the time out for the ping operation
Example: Using AS400JPing
The
following example shows how you can use AS400JPing within a Java program
to ping the Remote Command Service:
AS400JPing pingObj = new AS400JPing("myAS400", AS400.COMMAND, false);
if (pingObj.ping())
System.out.println("SUCCESS");
else
System.out.println("FAILED");