Call connect() on the specified address asynchronously.
MCO_RET mco_iot_comm_connect_async(mco_iot_comm_h comm,
const char *address,
timer_unit timeout,
unsigned int n_attempts,
timer_unit interval,
mco_sock_params_t *params);
comm
address
iface:port").timeout
connect() timeout (in milliseconds).n_attempts
connect() is called.interval
connect() attempts.params
This function calls connect() on the specified address
asynchronously and returns immediately before the connection has been
established. If the connection has been established successfully, the
onConnect() callback is called. Otherwise the onDestroy()
callback is invoked.
MCO_S_OK
MCO_E_IOT_INVALID_HANDLE
comm is invalid.MCO_E_NOMEM
MCO_E_NW_*
The code snippet below connects asynchronously to address
192.168.0.1:15000 with a connect timeout of 2 seconds, and
10 connect attempts with 1 second interval between attempts:
int main(int argc, char *argv[])
{
...
CHECK(mco_iot_comm_connect_async(comm, "192.168.0.1:15000", 2000, 10, 1000, 0));
...
}