LrJposChannel.isConnected

Checks if the client is connected to the server.

public static boolean isConnected()

Return values

This function returns true if the client is connected to the server and false if the client is not connected.

Example

Copy code
public int action() throws Throwable {
        
        if (LrJposChannel.isConnected()){
            lr.output_message("channel is connected");
            //send messages …
        }
        else {
            lr.output_message("channel is not connected");
            try {
                LrJposChannel.connect();
                lr.output_message("channel is now connected");
            }catch (Exception ex) {
                lr.output_message("channel cannot connect");
            }
        }
        return 0;
}