Bases: object
A 0MQ socket.
These objects will generally be constructed via the socket() method of a Context object.
Parameters : | context : Context
socket_type : int
|
---|
See also
Bind the socket to an address.
This causes the socket to listen on a network port. Sockets on the other side of this connection will use Socket.connect(addr) to connect to this socket.
Parameters : | addr : str
|
---|
Bind this socket to a random port in a range.
Parameters : | addr : str
min_port : int, optional
max_port : int, optional
max_tries : int, optional
|
---|---|
Returns : | port : int
|
Raises : | ZMQBindError :
|
Close the socket.
This can be called to close the socket by hand. If this is not called, the socket will automatically be closed when it is garbage collected.
Connect to a remote 0MQ socket.
Parameters : | addr : str
|
---|
Get the value of a socket option.
See the 0MQ documentation for details on specific options.
Parameters : | option : str
|
---|---|
Returns : | optval : int, str
|
Get the value of a socket option.
See the 0MQ documentation for details on specific options.
Parameters : | option : unicode string
|
---|---|
Returns : | optval : unicode
|
Are there more parts to a multipart message?
Returns : | more : bool
|
---|
Receive a message.
Parameters : | flags : int
copy : bool
track : bool
|
---|---|
Returns : | msg : str, Message
|
Raises : | ZMQError :
|
Receive a Python object as a message using json to serialize.
Parameters : | flags : int
|
---|---|
Returns : | obj : Python object
|
Receive a multipart message as a list of messages.
Parameters : | flags : int, optional
copy : bool, optional
track : bool, optional
|
---|---|
Returns : | msg_parts : list
|
Receive a Python object as a message using pickle to serialize.
Parameters : | flags : int
|
---|---|
Returns : | obj : Python object
|
Receive a unicode string, as sent by send_unicode.
Parameters : | flags : int
encoding : str [default: ‘utf-8’]
|
---|---|
Returns : | s : unicode string
|
Send a message on this socket.
This queues the message to be sent by the IO thread at a later time.
Parameters : | data : object, str, Message
flags : int
copy : bool
track : bool
|
---|---|
Returns : | None : if copy or not track
MessageTracker : if track and not copy
|
Raises : | TypeError :
ValueError :
ZMQError :
|
Send a Python object as a message using json to serialize.
Parameters : | obj : Python object
flags : int
|
---|
Send a sequence of messages as a multipart message.
Parameters : | msg_parts : iterable
flags : int, optional
copy : bool, optional
track : bool, optional
|
---|---|
Returns : | None : if copy or not track MessageTracker : if track and not copy
|
Send a Python object as a message using pickle to serialize.
Parameters : | obj : Python object
flags : int
protocol : int
|
---|
Send a Python unicode object as a message with an encoding.
Parameters : | u : Python unicode object
flags : int, optional
encoding : str [default: ‘utf-8’]
|
---|
Set socket options.
See the 0MQ documentation for details on specific options.
Parameters : | option : str
optval : int or str
|
---|
Set socket options with a unicode object it is simply a wrapper for setsockopt to protect from encoding ambiguity.
See the 0MQ documentation for details on specific options.
Parameters : | option : int
optval : unicode
encoding : str
|
---|