mco_iot_comm_stop_connect

Interrupt the asynchronous connect initiated through the mco_iot_comm_connect_async().

For an overview see page ARF Applications in C

Prototype

    MCO_RET mco_iot_comm_stop_connect(mco_iot_comm_h comm,
                    const char *address);

Arguments

comm
The communicator object
address
The IP address (in format "iface:port")

Description

This function interrupts the asynchronous connect initiated through the mco_iot_comm_connect_async(). The address string must be identical to the string passed into the mco_iot_comm_connect_async().

Return Codes

MCO_S_OK
Connection successfully interrupted
MCO_E_IOT_INVALID_HANDLE
The communicator handle comm is invalid
MCO_E_IOT_AGENT_NOT_FOUND
The connection to the specified address not found (was never initiated or already completed with error or success)

Example

The code snippet below interrupts the connection previously initiated with mco_iot_comm_connect_async():

    int main(int argc, char *argv[])
    {
        ...
        CHECK(mco_iot_comm_connect_async(comm, "192.168.0.1:15000", 2000, 10, 1000, 0));
        ...
        CHECK(mco_iot_comm_stop_connect(comm, "192.168.0.1:15000"));
        ...
    }

Files

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