Maximum length of binary/string type option values. (Large enough to hold ZMQ_IDENTITY / ZMQ_LAST_ENDPOINT)
POEx::ZMQ::FFI::Socket
# Used internally by POEx::ZMQ
An object representing a ZeroMQ socket; used internally by POEx::ZMQ.
This is essentially a minimalist reimplementation of Dylan Cali's ZMQ::FFI; see ZMQ::FFI for a ZeroMQ FFI implementation intended for use outside POE.
The POEx::ZMQ::FFI::Context object this socket belongs to.
The ZeroMQ socket type (as a constant value, see POEx::ZMQ::Constants).
Required at creation time.
The libzmq dynamic library we are using.
libzmq
Retrieved from our "context" object by default.
$zsock->connect( $endpoint );
See zmq_connect(3)
$zsock->disconnect( $endpoint );
See zmq_disconnect(3)
$zsock->bind( $endpoint );
See zmq_bind(3)
$zsock->unbind( $endpoint );
See zmq_unbind(3)
$zsock->send( $data, $flags );
Send a single-part message.
See zmq_msg_send(3).
Send a multi-part message via ZMQ_SNDMORE.
ZMQ_SNDMORE
my $msg = $zsock->recv($flags);
Retrieve a single message part.
This could actually be the first part of a multi-part message. Also see "recv_multipart".
my $parts = $zsock->recv_multipart;
Retrieve all available parts of a message and return them as a List::Objects::WithUtils::Array.
This is preferable over a "recv", as it handles RCVMORE semantics. (If this was a single-part message, there is one item in the array.)
my $opt_type = $zsock->known_type_for_opt( $opt_constant );
Returns the type of an option for use with "get_sock_opt" & "set_sock_opt".
my $val = $zsock->get_sock_opt( $opt_constant ); # Or manually specify value type: my $val = $zsock->get_sock_opt( $opt_constant, 'int64' );
Retrieves the currently-set value of a ZeroMQ option constant (see POEx::ZMQ::Constants).
See the zmq_getsockopt(3) man page for details regarding option constants and their returned values.
You should typically be able to omit the option value's type -- this class will try to Do The Right Thing. The internal option => type map is exposed via "known_type_for_opt"; it should be reasonably complete. If you have to specify your own value type for a new or missing option, file a bug via http://www.github.com/avenj/poex-zmq|GitHub or RT.
option => type
$zsock->set_sock_opt( $opt_constant, $val ); $zsock->set_sock_opt( $opt_constant, $val, $type );
Set ZeroMQ options; all "get_sock_opt" caveats apply here, also.
See the zmq_setsockopt(3) man page.
Returns a file handle (suitable for polling by an event loop such as POE) by performing an fdopen(3) on the file descriptor returned by the ZMQ_FD socket option; see zmq_getsockopt(3) and the http://zguide.zeromq.org|zguide.
ZMQ_FD
Returns the raw socket ptr, suitable for use with direct FFI::Raw calls.
Checks the ZMQ_EVENTS socket option to determine if the socket is readable.
ZMQ_EVENTS
Checks the ZMQ_EVENTS socket option to determine if the socket is writable.
POEx::ZMQ::FFI::Role::ErrorChecking
Jon Portnoy <avenj@cobaltirc.org>
Significant portions of this code are inspired by or derived from ZMQ::FFI by Dylan Cali (CPAN: CALID).
To install POEx::ZMQ, copy and paste the appropriate command in to your terminal.
cpanm
cpanm POEx::ZMQ
CPAN shell
perl -MCPAN -e shell install POEx::ZMQ
For more information on module installation, please visit the detailed CPAN module installation guide.