Expand/Shrink

nopoll_conn_is_ready

Definition: include nopoll.e

bool ok = nopoll_conn_is_ready(atom conn)
Description: Check if the connection is ready to be used (handshake completed).

Note this function may block the caller in the case the handshake is not completed.

conn: The connection to be checked.

Returns: true in the case the handshake was completed otherwise false is returned.
The function also returns false in case nopoll_conn_is_ok() is failing.
Example:
include nopoll.e

atom ctx = nopoll_ctx_new()
atom conn = nopoll_conn_new(ctx, "echo.websocket.org", "80", NULL, "/", NULL, NULL)
if not nopoll_conn_is_ok(conn) then
    -- some error handling here
end if
if not nopoll_conn_wait_until_connection_ready(conn, 5) then
    -- some error handling
end if

if nopoll_conn_send_text(conn, "Hello there! this is a test", 27) != 27 then
    -- yet more error handling
end if

...
See Also: nopoll_conn_wait_until_connection_ready