mco_iot_conn_get_stat
此函数接收一个 mco_iot_connection_stat_t
结构作为参数 stat
,其中包含连接统计信息。
MCO_RET mco_iot_conn_get_stat(
mco_iot_connection_h iotc,
mco_iot_connection_stat_t *stat
);
有关概述,请参阅主动复制结构页面。
参数
iotc
iot_connection_h
连接句柄。
stat
mco_iot_connection_stat_t
连接统计结构:
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;
返回
MCO_S_OK
已成功返回连接统计信息。
MCO_E_IOT_INVALID_HANDLE
连接句柄 iotc
无效。
示例
{
// 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
...
}
文件
- 头文件:
mcoiot.h
- 源文件:
mcoiotcomm.c
- 库:
libmcoiotcomm.a