Sha256: 5c5c465d2f9e8460758ff6da31f09800325e1be6aca16d0010f7c55c779841cc
Contents?: true
Size: 1.18 KB
Versions: 1
Compression:
Stored size: 1.18 KB
Contents
module Celluloid module ZMQ class Socket # Readable 0MQ sockets have a read method module Readable extend Forwardable def_delegator ZMQ, :result_ok? # always set LINGER on readable sockets def bind(addr) self.linger = @linger super(addr) end def connect(addr) self.linger = @linger super(addr) end # Read a message from the socket def read(buffer = '') ZMQ.wait_readable(@socket) if ZMQ.evented? unless result_ok? @socket.recv_string buffer raise IOError, "error receiving ZMQ string: #{::ZMQ::Util.error_string}" end buffer end # Multiparts message ? def_delegator :@socket, :more_parts? # Reads a multipart message, stores it into the given buffer and returns # the buffer. def read_multipart(buffer = []) ZMQ.wait_readable(@socket) if ZMQ.evented? unless result_ok? @socket.recv_strings buffer raise IOError, "error receiving ZMQ string: #{::ZMQ::Util.error_string}" end buffer end end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
celluloid-zmq-0.17.0 | lib/celluloid/zmq/socket/readable.rb |