noPollMsg* nopoll_conn_get_msg ( noPollConn conn)

Allows to get the next message available on the provided connection.

The function returns NULL in the case no message is still ready to be returned.

This function is design to not block the caller. However, connection socket must be in non-blocking configuration. If you have not configured anything, this is the default.

If the function blocks caller then the socket associated to noPollConn is configured to make blocking I/O (maybe because you configured like this or the socket was passed to another library that did such configuration or maybe because you are using nopoll_conn_new_with_socket).

Parameters
connThe connection where the read operation will take place.
Returns
A reference to a noPollMsg object or NULL if there is nothing available. In case the function returns NULL, check connection status with nopoll_conn_is_ok. If the function blocks the caller check socket configuration.

References NOPOLL_CLOSE_FRAME, nopoll_conn_complete_handshake(), nopoll_conn_is_ok(), nopoll_conn_set_sock_block(), nopoll_conn_shutdown(), NOPOLL_EWOULDBLOCK, nopoll_false, nopoll_free(), nopoll_get_32bit(), NOPOLL_LEVEL_CRITICAL, NOPOLL_LEVEL_DEBUG, NOPOLL_LEVEL_WARNING, nopoll_msg_get_payload(), nopoll_msg_get_payload_size(), nopoll_msg_ref(), nopoll_msg_unref(), nopoll_mutex_lock(), nopoll_mutex_unlock(), nopoll_new, NOPOLL_PING_FRAME, NOPOLL_PONG_FRAME, NOPOLL_ROLE_LISTENER, nopoll_strdup(), and nopoll_true.

Referenced by nopoll_conn_read().