# mco_iot_comm_stop_listen

Close the listen socket on the specified IP address.

### For an overview see page ARF Applications in C

### Prototype

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

### Arguments

comm | The communicator object
address | The IP address ("`iface:port`" or “`port`”) to stop listening on

### Description

This function closes the listen socket. The address string must be identical to the string passed into the `mco_iot_comm_listen()`.

### Return Codes

MCO_S_OK | Socket successfully closed and listening stopped
MCO_E_IOT_INVALID_HANDLE | The communicator handle `comm` is invalid
MCO_E_IOT_AGENT_NOT_FOUND | Unable to find the listen socket on the specified address

### Example

The code snippet below stops listening on the previously created socket (see also `mco_iot_comm_listen`):

        int main(int argc, char *argv[])
        {
            ...
            mco_iot_comm_listen(comm, "15000", 0);
            ...
            CHECK(mco_iot_comm_stop_listen(comm, "15000"));
            ...
        }

### Files

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