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

#binmode, #lineno, #lineno=, #rewind, #seek, #set_encoding, #to_io

Methods included from Module::IO::ClassMethods

#copy_stream, #open, #pipe, #select

Methods included from IO::IOMethods

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

Constructor Details

#initialize(*args) ⇒ TCPServer

Returns a new instance of TCPServer.



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

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

Instance Method Details

#acceptObject



174
175
176
177
# File 'lib/lightio/library/socket.rb', line 174

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

#accept_nonblock(*args) ⇒ Object



179
180
181
182
# File 'lib/lightio/library/socket.rb', line 179

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

#sys_acceptObject



184
185
186
187
# File 'lib/lightio/library/socket.rb', line 184

def sys_accept
  io_watcher.wait_readable
  @obj.sys_accept
end