Share this page

# LrJposChannel.getCounters

Gets the count for connected clients, send messages, and received messages.

`public static int[] getCounters()`

## Return values

This function returns an array of integers for connections/sent messages/received messages.

## General information

The internal counters store the data in an array of integers:

- A[0]: Number of connections.

- A[1]: Number of sent messages.

- A[2]: Number of received messages.

Received messages using the LrJposChannel.getBytes function are not counted within this array.

## Example

Copy code

    public void checkAndResetCurrentCounters() {

            int counters[] = LrJposChannel.getCounters();
            if (counters.length<3) {
                lr.error_message("we should have 3 entries in counters array");
                return;
            }
            lr.output_message("Connections#" + counters[0]);
            lr.output_message("SentMessges#" + counters[1]);
            lr.output_message("ReceivedMessages#" + counters[2]);

            lr.output_message("resetting counters");
            LrJposChannel.resetCounters();

            counters = LrJposChannel.getCounters();
            if (counters.length<3) {
                lr.error_message("we should have 3 entries in counters array");
                return;
            }
            lr.output_message("Connections#" + counters[0]);
            lr.output_message("SentMessges#" + counters[1]);
            lr.output_message("ReceivedMessages#" + counters[2]);
     }

Tips to improve your search results... VuGen Function Reference Version 26.1 Function Reference 26.1 All View Local Help Center View Online Help Center Version: