module ZMQ::Util

Extended Modules

Defined in:

zeromq/util.cr

Constant Summary

MSG_ERRORS = {"zmq_msg_init", "zmq_msg_init_data", "zmq_msg_copy", "zmq_msg_move", "zmq_msg_close", "zmq_msg_get", "zmq_msg_more", "zmq_msg_recv", "zmq_msg_send", "zmq_msg_set"}

Instance Method Summary

Instance Method Detail

def bind_to_random_tcp_port(host = "127.0.0.1", max_tries = 500) #

Attempts to bind to a random tcp port on +host+ up to +max_tries+ times. Returns the port number upon success or nil upon failure.


[View source]
def curve_keypair #

[View source]
def errno #

Returns the +errno+ as set by the libzmq library.


[View source]
def error_check(source, result_code) #

:doc: Called to verify whether there were any errors during operation. If any are found, raise the appropriate #ZeroMQError.

When no error is found, this method returns +true+ which is behavior used internally by #send and #recv.


[View source]
def error_string #

Returns a string corresponding to the currently set #errno. These error strings are defined by libzmq.


[View source]
def resultcode_ok?(rc) #

Returns true when +rc+ is greater than or equal to 0, false otherwise.

We use the >= test because zmq_poll() returns the number of sockets that had a read or write event triggered. So, a >= 0 result means it succeeded.


[View source]