NAME
ZMQ::Raw::Socket - ZeroMQ Socket class
VERSION
version 0.34
DESCRIPTION
A ZMQ::Raw::Socket represents a ZeroMQ socket.
SYNOPSIS
use ZMQ::Raw;
# receive a single message-part
my $msg = $socket->recvmsg();
# receive all message parts
my @msgs = $socket->recvmsg();
# send multiple message parts
$socket->sendmsg ('hello', 'world'); # flags cannot be used here
# or
my $msg1 = ZMQ::Raw::Message->new;
$msg1->data ('hello');
my $msg2 = ZMQ::Raw::Message->new;
$msg2->data ('world');
$socket->sendmsg ($msg1, $msgs2, 0); # flags can be used here
METHODS
new( $context, $type )
Create a new ZeroMQ socket with the specified $context
. $type
specifies the socket type, which determines the semantics of communication over the socket.
bind( $endpoint )
Bind the socket to a local endpoint which accepts incoming connections. The endpoint is a string consisting of a transport:// followed by an address. The transport specifies the underlying protocol to use, whereas the address specifies the transport-specific address to bind to. The following transports are provided:
"tcp"
unicast transport using TCP
"ipc"
local inter-process communication transport
"inproc"
local in-process (inter-thread) communication transport
"pgm,epgm"
reliable multicast transport using PGM
"vmci"
virtual machine communications interface (VMCI)
unbind( $endpoint )
Unbind the socket from the endpoint.
connect( $endpoint )
Connect the socket to an endpoint which accepts incoming connections.
disconnect( $endpoint )
Disconnect the socket from the endpoint. Any outstanding messages physically received from the network but not yet received by the application will be discarded.
send( $buffer, $flags = 0)
Queue a message created from $buffer
. $flags
defaults to 0
but may be a combination of:
ZMQ::Raw->ZMQ_DONTWAIT
Perform the operation in non-blocking mode. This method will return
undef
if the message cannot be sent immediately.ZMQ::Raw->ZMQ_SNDMORE
The message is part of a multi-part message and further message parts are to follow.
This method may return undef
(or an empty list if called in list context) if the system call was interrupt or if the operation cannot be completed immediately, after which it may be reattempted.
close( )
Close the socket. Any outstanding messages physically received from the network but not yet received by the application will be discarded.
monitor( $endpoint, $events)
Track socket events. Each call to this method creates a ZMQ_PAIR
socket and binds that to the specified inproc $endpoint
. In order to collect socket events, you must create your own ZMQ_PAIR
socket and connect it to the $endpoint
.
sendmsg( @msgs, $flags = 0)
Queue @msgs
to be sent. Each message in @msgs
that is a ZMQ::Raw::Message
is still valid after this call, that is, they may be reused. Each item in @msgs
may either be a ZMQ::Raw::Message
object or a "normal" perl scalar. The $flags
parameter is only available if all items in @msgs
are ZMQ::Raw::Message
objects. See the SYNOPSIS for usage examples.
This method may return undef
(or an empty list if called in list context) if the system call was interrupt or if the operation cannot be completed immediately, after which it may be reattempted.
recv( $flags = 0)
Receive a message. If there are no messages available the method will block until the request can be satisfied unless the ZMQ_DONTWAIT
flag is specified. If a message is not available and ZMQ_DONTWAIT
has been specified, this method will return undef
immediately. If called in list context, this method will return each part of the message as a scalar item. In scalar context, each part of the message will be concatenated into a single scalar item.
This method may return undef
(or an empty list if called in list context) if the system call was interrupt or if the operation cannot be completed immediately, after which it may be reattempted.
recvmsg( $flags = 0)
Receive a message part or multiple messages parts if called in list context. Returns a ZMQ::Raw::Message
object or an array of object.
This method may return undef
(or an empty list if called in list context) if the system call was interrupt or if the operation cannot be completed immediately, after which it may be reattempted.
setsockopt( $option, $value )
Set a socket option.
join( $group )
Join a group.
leave( $group )
Leave a group.
CONSTANTS
ZMQ_AFFINITY
ZMQ_IDENTITY
ZMQ_SUBSCRIBE
ZMQ_UNSUBSCRIBE
ZMQ_RATE
ZMQ_RECOVERY_IVL
ZMQ_SNDBUF
ZMQ_RCVBUF
ZMQ_RCVMORE
ZMQ_FD
ZMQ_EVENTS
ZMQ_TYPE
ZMQ_LINGER
ZMQ_RECONNECT_IVL
ZMQ_BACKLOG
ZMQ_RECONNECT_IVL_MAX
ZMQ_MAXMSGSIZE
ZMQ_SNDHWM
ZMQ_RCVHWM
ZMQ_MULTICAST_HOPS
ZMQ_RCVTIMEO
ZMQ_SNDTIMEO
ZMQ_LAST_ENDPOINT
ZMQ_ROUTER_MANDATORY
ZMQ_TCP_KEEPALIVE
ZMQ_TCP_KEEPALIVE_CNT
ZMQ_TCP_KEEPALIVE_IDLE
ZMQ_TCP_KEEPALIVE_INTVL
ZMQ_IMMEDIATE
ZMQ_XPUB_VERBOSE
ZMQ_ROUTER_RAW
ZMQ_IPV6
ZMQ_MECHANISM
ZMQ_PLAIN_SERVER
ZMQ_PLAIN_USERNAME
ZMQ_PLAIN_PASSWORD
ZMQ_CURVE_SERVER
ZMQ_CURVE_PUBLICKEY
ZMQ_CURVE_SECRETKEY
ZMQ_CURVE_SERVERKEY
ZMQ_PROBE_ROUTER
ZMQ_REQ_CORRELATE
ZMQ_REQ_RELAXED
ZMQ_CONFLATE
ZMQ_ZAP_DOMAIN
ZMQ_ROUTER_HANDOVER
ZMQ_TOS
ZMQ_CONNECT_RID
ZMQ_GSSAPI_SERVER
ZMQ_GSSAPI_PRINCIPAL
ZMQ_GSSAPI_SERVICE_PRINCIPAL
ZMQ_GSSAPI_PLAINTEXT
ZMQ_HANDSHAKE_IVL
ZMQ_SOCKS_PROXY
ZMQ_XPUB_NODROP
ZMQ_BLOCKY
ZMQ_XPUB_MANUAL
ZMQ_XPUB_WELCOME_MSG
ZMQ_STREAM_NOTIFY
ZMQ_INVERT_MATCHING
ZMQ_HEARTBEAT_IVL
ZMQ_HEARTBEAT_TTL
ZMQ_HEARTBEAT_TIMEOUT
ZMQ_XPUB_VERBOSER
ZMQ_CONNECT_TIMEOUT
ZMQ_TCP_MAXRT
ZMQ_THREAD_SAFE
ZMQ_MULTICAST_MAXTPDU
ZMQ_VMCI_BUFFER_SIZE
ZMQ_VMCI_BUFFER_MIN_SIZE
ZMQ_VMCI_BUFFER_MAX_SIZE
ZMQ_VMCI_CONNECT_TIMEOUT
ZMQ_USE_FD
AUTHOR
Jacques Germishuys <jacquesg@striata.com>
LICENSE AND COPYRIGHT
Copyright 2017 Jacques Germishuys.
This program is free software; you can redistribute it and/or modify it under the terms of either: the GNU General Public License as published by the Free Software Foundation; or the Artistic License.
See http://dev.perl.org/licenses/ for more information.