# mcorest_start
RT

### Prototype

        MCO_RET mcorest_start(void);

### Description

> `mcorest_start()` launches the RESTrt web service handling loop.

>     static void rest_loop_task(void *args)
>     {
>         MCO_RET rc;
>         mco_sock_params_t s_params;
>         mco_socket_params_init(&s_params);
>         s_params.mode = MCO_SOCK_NON_BLOCKING;

>         rc = mcorest_initialize(db_name, INTERFACE, PORT, &s_params);
>         if (rc != MCO_S_OK) {
>             printf("ERROR: mcorest_initialize() failed: %d (%s)\n", rc, mco_strerror(rc));
>             return;
>         }
>         printf("Starting rest on port %d...\n", PORT);
>         rc = mcorest_start();
>         if (rc != MCO_S_OK) {
>             printf("ERROR: mcorest_start() failed: %d (%s)\n", rc, mco_strerror(rc));
>             return;
>         }

>         mcorest_shutdown();
>         printf("REST loop task done\n");
>     }

### Return Codes

MCO_S_OK | The loop finished without errors.
MCO_E_LEWS_NOT_INITIALIZED | The service was not initialized.
MCO_E_LEWS_LISTEN | Error initializing the listening network socket.

### Files

Header file:
mcorestrt.h
Source file:
mcorestrt.c
Library:
libmcorestrt.a