Class: MessagePack::RPC::UDPTransport::BasicSocket
- Inherits:
-
Cool.io::IOWatcher
- Object
- Cool.io::IOWatcher
- MessagePack::RPC::UDPTransport::BasicSocket
- Includes:
- MessageReceiver
- Defined in:
- lib/msgpack/rpc/transport/udp.rb
Direct Known Subclasses
MessagePack::RPC::UDPClientTransport::ClientSocket, MessagePack::RPC::UDPServerTransport::ServerSocket
Constant Summary collapse
- HAVE_DNRL =
UDPSocket.public_instance_methods.include?(:do_not_reverse_lookup)
Instance Attribute Summary collapse
-
#io ⇒ Object
readonly
Returns the value of attribute io.
Instance Method Summary collapse
-
#initialize(io) ⇒ BasicSocket
constructor
A new instance of BasicSocket.
- #on_readable ⇒ Object
Methods included from MessageReceiver
Constructor Details
#initialize(io) ⇒ BasicSocket
Returns a new instance of BasicSocket.
34 35 36 37 38 |
# File 'lib/msgpack/rpc/transport/udp.rb', line 34 def initialize(io) io.do_not_reverse_lookup = true if HAVE_DNRL super(io) @io = io end |
Instance Attribute Details
#io ⇒ Object (readonly)
Returns the value of attribute io.
40 41 42 |
# File 'lib/msgpack/rpc/transport/udp.rb', line 40 def io @io end |
Instance Method Details
#on_readable ⇒ Object
42 43 44 45 46 47 48 49 50 51 52 53 54 55 |
# File 'lib/msgpack/rpc/transport/udp.rb', line 42 def on_readable begin data, addr = @io.recvfrom(64*1024) # FIXME buffer size rescue Errno::EAGAIN return end # FIXME multiple objects in one message obj = MessagePack.unpack(data) (obj, addr) rescue # FIXME log return end |