Parent

Celluloid::IO::UDPSocket

UDPSockets with combined blocking and evented support

Public Class Methods

new(address_family = ::Socket::AF_INET) click to toggle source
# File lib/celluloid/io/udp_socket.rb, line 8
def initialize(address_family = ::Socket::AF_INET)
  @socket = ::UDPSocket.new(address_family)
end

Public Instance Methods

recvfrom(maxlen, flags = nil) click to toggle source

Receives up to maxlen bytes from socket. flags is zero or more of the MSG_ options. The first element of the results, mesg, is the data received. The second element, sender_addrinfo, contains protocol-specific address information of the sender.

# File lib/celluloid/io/udp_socket.rb, line 19
def recvfrom(maxlen, flags = nil)
  begin
    if @socket.respond_to? :recvfrom_nonblock
      @socket.recvfrom_nonblock(maxlen, flags)
    else
      # FIXME: hax for JRuby
      @socket.recvfrom(maxlen, flags)
    end
  rescue ::IO::WaitReadable
    wait_readable
    retry
  end
end
to_io() click to toggle source
# File lib/celluloid/io/udp_socket.rb, line 33
def to_io; @socket; end
wait_readable() click to toggle source

Wait until the socket is readable

# File lib/celluloid/io/udp_socket.rb, line 13
def wait_readable; Celluloid::IO.wait_readable(self); end

[Validate]

Generated with the Darkfish Rdoc Generator 2.