# mco_cluster_discover

This function allows an application to get information about a working cluster.

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

### Prototype

        MCO_RET mco_cluster_discover( /*IN*/ const char * conn_string,
                          /*IN*/ timer_unit timeout,
                         /*OUT*/ mco_cluster_node_info_t *nodes_info,
                         /*IN/OUT*/ uint2 *n_nodes_info)

### Arguments

conn_string | The address of one of the nodes in the cluster (for TCP transport - in the standard form <hostname/IP>:<port>)
timeout | The timeout to connect to the node and to get information from it
nodes_info | Array of node's info (`address`, `nodeID` and `Qrank`).
n_nodes_info | The size of `nodes_info` array. On input, it specifies the allocated size of array, on the output - actual number of filled elements

### Description

This function gets information about a working cluster. Note, that it's not necessary to call this function before`mco_cluster_db_open()`.This function is similar to ``mco_cluster_get_active_nodes()`` with the difference that `mco_cluster_discover()` can be called on any network node (not necessarily a node that is running cluster at the moment) and returns a list of cluster nodes with their IPs, IDs.

### Return Codes

MCO_S_OK | The information was obtained successfully,`n_nodes_info` contains the actual size of the`nodes_info` array
MCO_E_NW_INVADDR | The `conn_string` doesn't contain valid address
MCO_E_NW_TIMEOUT | The timeout occurred before information was obtained
MCO_E_NW_SOCKIOCTL | An error occurred in `ioctl()` syscall
MCO_E_NW_SOCKOPT | An error occurred in `setsockopt()` syscall
MCO_E_NW_SELECT | An error occurred in `select()` syscall
MCO_E_NW_CONNECT | An error occurred in `connect()` syscall
MCO_E_NW_SENDERR | An error occurred in `send()` syscall
MCO_E_NW_RECVERR | An error occurred in `recv()` syscall

### Files

Header file:
mcocluster.h
Source file:
mcocluster.c
Library:
libmcocluster.a