Class: LightIO::Library::TCPServer

Inherits:
TCPSocket show all
Includes:
Base
Defined in:
lib/lightio/library/socket.rb

Instance Method Summary collapse

Methods included from Base

included

Methods inherited from BasicSocket

#shutdown

Methods included from Module::BasicSocket::ClassMethods

#for_fd

Methods included from Wrap::IOWrapper

included

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

Constructor Details

#initialize(*args) ⇒ TCPServer

Returns a new instance of TCPServer.



168
169
170
# File 'lib/lightio/library/socket.rb', line 168

def initialize(*args)
  @obj = ::TCPServer.send(:origin_new, *args)
end

Instance Method Details

#acceptObject



172
173
174
175
# File 'lib/lightio/library/socket.rb', line 172

def accept
  socket = wait_nonblock(:accept_nonblock)
  TCPSocket._wrap(socket)
end

#accept_nonblock(*args) ⇒ Object



177
178
179
180
# File 'lib/lightio/library/socket.rb', line 177

def accept_nonblock(*args)
  socket = @obj.accept_nonblock(*args)
  socket.is_a?(Symbol) ? socket : TCPSocket._wrap(socket)
end

#sys_acceptObject



182
183
184
185
# File 'lib/lightio/library/socket.rb', line 182

def sys_accept
  io_watcher.wait_readable
  @obj.sys_accept
end