Class: ZMQ::Socket
- Inherits:
-
Object
- Object
- ZMQ::Socket
- Includes:
- CommonSocketBehavior, IdentitySupport
- Defined in:
- lib/ffi-rzmq/socket.rb,
lib/ffi-rzmq/socket.rb
Instance Attribute Summary
Attributes included from CommonSocketBehavior
Instance Method Summary (collapse)
-
- (Object) getsockopt(name, array)
Get the options set on this socket.
Methods included from IdentitySupport
Methods included from CommonSocketBehavior
#bind, #close, #connect, create, #initialize, #more_parts?, #recv_multipart, #recv_string, #recv_strings, #recvmsg, #recvmsgs, #send_and_close, #send_string, #send_strings, #sendmsg, #sendmsgs, #setsockopt
Methods included from Util
bind_to_random_tcp_port, errno, error_string, resultcode_ok?, version
Instance Method Details
- (Object) getsockopt(name, array)
Get the options set on this socket.
name determines the socket option to request array should be an empty array; a result of the proper type (numeric, string, boolean) will be inserted into the first position.
Valid option_name values:
ZMQ::RCVMORE - true or false
ZMQ::HWM - integer
ZMQ::SWAP - integer
ZMQ::AFFINITY - bitmap in an integer
ZMQ::IDENTITY - string
ZMQ::RATE - integer
ZMQ::RECOVERY_IVL - integer
ZMQ::SNDBUF - integer
ZMQ::RCVBUF - integer
ZMQ::FD - fd in an integer
ZMQ::EVENTS - bitmap integer
ZMQ::LINGER - integer measured in milliseconds
ZMQ::RECONNECT_IVL - integer measured in milliseconds
ZMQ::BACKLOG - integer
ZMQ::RECOVER_IVL_MSEC - integer measured in milliseconds
Returns 0 when the operation completed successfully. Returns -1 when this operation failed.
With a -1 return code, the user must check ZMQ.errno to determine the cause.
# retrieve high water mark
array = []
rc = socket.getsockopt(ZMQ::HWM, array)
hwm = array.first if ZMQ::Util.resultcode_ok?(rc)
610 611 612 613 614 615 616 617 618 619 |
# File 'lib/ffi-rzmq/socket.rb', line 610 def getsockopt name, array rc = __getsockopt__ name, array if Util.resultcode_ok?(rc) && (RCVMORE == name) # convert to boolean array[0] = 1 == array[0] end rc end |