Class: LightIO::Library::Socket

Inherits:
BasicSocket show all
Extended by:
Module::Socket::ClassMethods
Includes:
Base, Wrap::IOWrapper, Socket::Constants
Defined in:
lib/lightio/library/socket.rb

Defined Under Namespace

Classes: Ifaddr

Constant Summary collapse

Option =
::Socket::Option
UDPSource =
::Socket::UDPSource
SocketError =
::SocketError
Addrinfo =
Addrinfo

Instance Method Summary collapse

Methods included from Module::Socket::ClassMethods

getaddrinfo, getifaddrs, ip_sockets_port0, socketpair, unix_server_socket

Methods included from Wrap::IOWrapper

included, #initialize

Methods included from Base

included, #initialize

Methods inherited from BasicSocket

#shutdown

Methods included from Module::BasicSocket::ClassMethods

#for_fd

Methods inherited from IO

#to_io

Methods included from Module::IO::ClassMethods

#open, #pipe, #select

Methods included from IO::IOMethods

#close, #eof, #getbyte, #getc, #gets, included, #print, #printf, #puts, #read, #readbyte, #readchar, #readline, #readlines, #readpartial, #wait, #wait_readable, #wait_writable

Instance Method Details

#acceptObject



116
117
118
119
# File 'lib/lightio/library/socket.rb', line 116

def accept
  socket, addrinfo = wait_nonblock(:accept_nonblock)
  [self.class._wrap(socket), Addrinfo._wrap(addrinfo)]
end

#accept_nonblock(*args) ⇒ Object



121
122
123
124
125
126
127
128
# File 'lib/lightio/library/socket.rb', line 121

def accept_nonblock(*args)
  socket, addrinfo = @obj.accept_nonblock(*args)
  if socket.is_a?(Symbol)
    [socket, nil]
  else
    [self.class._wrap(socket), Addrinfo._wrap(addrinfo)]
  end
end

#sys_acceptObject



84
85
86
87
# File 'lib/lightio/library/socket.rb', line 84

def sys_accept
  io_watcher.wait_readable
  @obj.sys_accept
end