mco_iot_conn_get_stat

Receive connection statistics.

For an overview see page ARF Applications in C

Prototype

    MCO_RET mco_iot_conn_get_stat(mco_iot_connection_h iotc,
                    mco_iot_connection_stat_t *stat);

Arguments

iotc
The connection handle (iot_connection_h).
stat

The connection statistics structure:

    typedef struct mco_iot_connection_stat_t_
    {
        mco_inetaddr_t inetaddr;   /* peer IP */
        int            port;       /* peer port */
        uint8          sent_bytes; /* TX bytes */
        uint8          recv_bytes; /* RX bytes */
    } mco_iot_connection_stat_t;

Description

This function receives a mco_iot_connection_stat_t structure (see above) with connection statistics in argument stat.

Return Codes

MCO_S_OK
Connection statistics successfully returned.
MCO_E_IOT_INVALID_HANDLE
The connection handle iotc is invalid.

Example

    {
        // Get statistics for agent_id
        mco_iot_connection_stat_t cstat;
        mco_iot_connection_h conn = mco_iot_comm_find_conn(comm, agent_id);
        mco_iot_conn_get_stat(conn, &cstat);
        mco_iot_conn_release(conn);
        // Print out cstat values
        ...
    }

Files

Header file:
mcoiot.h
Source file:
mcoiotcomm.c
Library:
libmcoiotcomm.a