Return the next active connection for this communicator.
iot_connection_h mco_iot_comm_next_conn(mco_iot_comm_h comm,
iot_connection_h prev);
comm
prev
This function returns the next connection for this communicator
and automatically calls mco_iot_conn_release()
for the previous connection prev. This function can be used
to list all active connections, but the order in which they are listed
is undefined. Note that the mco_iot_comm_find_conn()
and mco_iot_comm_next_conn() APIs “lock/pin” the connection
handle to protect the handle from being destroyed. When the handle is
no longer needed, the “pin” should be removed by calling
mco_iot_conn_release(). The safer
way to enumerating active connections (from the "pin/unpin" standpoint)
is to use the mco_iot_replicator_enum_agents() API.
iot_connection_h
{
conn = 0;
while ((conn = mco_iot_comm_next_conn(comm, conn)))
{
// if prev == 0 - start over; _next_conn() automatically calls release() for the previous connection
// Do something with connection conn
if (!condition)
{
break;
}
}
if (conn)
{
mco_iot_conn_release(conn); // explicitly release connection
}
}