Class: LightIO::Library::Socket
- Inherits:
-
BasicSocket
- Object
- IO
- BasicSocket
- LightIO::Library::Socket
- Includes:
- 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
Class Method Summary collapse
-
.getaddrinfo ⇒ Object
implement ::Socket class methods.
- .getifaddrs ⇒ Object
- .ip_sockets_port0(ai_list, reuseaddr) ⇒ Object
- .socketpair(domain, type, protocol) ⇒ Object (also: pair)
- .unix_server_socket(path) ⇒ Object
Instance Method Summary collapse
-
#accept ⇒ Object
implement ::Socket instance methods.
- #sys_accept ⇒ Object
Methods included from Wrap::IOWrapper
Methods included from Wrap::Wrapper
included, #initialize, #method_missing
Methods inherited from BasicSocket
Methods inherited from IO
#close, #eof, #getbyte, #getc, #gets, open, pipe, #read, #readbyte, #readchar, #readline, #readlines, #readpartial, select, #to_io
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class LightIO::Wrap::Wrapper
Class Method Details
.getaddrinfo ⇒ Object
implement ::Socket class methods
131 132 |
# File 'lib/lightio/library/socket.rb', line 131 wrap_methods_run_in_threads_pool :getaddrinfo, :gethostbyaddr, :gethostbyname, :gethostname, :getnameinfo, :getservbyname |
.getifaddrs ⇒ Object
134 135 136 |
# File 'lib/lightio/library/socket.rb', line 134 def getifaddrs raw_class.getifaddrs.map {|ifaddr| Ifaddr._wrap(ifaddr)} end |
.ip_sockets_port0(ai_list, reuseaddr) ⇒ Object
152 153 154 |
# File 'lib/lightio/library/socket.rb', line 152 def ip_sockets_port0(ai_list, reuseaddr) raw_class.ip_sockets_port0(ai_list, reuseaddr).map {|s| _wrap(s)} end |
.socketpair(domain, type, protocol) ⇒ Object Also known as: pair
138 139 140 |
# File 'lib/lightio/library/socket.rb', line 138 def socketpair(domain, type, protocol) raw_class.socketpair(domain, type, protocol).map {|s| _wrap(s)} end |
.unix_server_socket(path) ⇒ Object
144 145 146 147 148 149 150 |
# File 'lib/lightio/library/socket.rb', line 144 def unix_server_socket(path) if block_given? raw_class.unix_server_socket(path) {|s| yield _wrap(s)} else _wrap(raw_class.unix_server_socket(path)) end end |
Instance Method Details
#accept ⇒ Object
implement ::Socket instance methods
94 95 96 97 |
# File 'lib/lightio/library/socket.rb', line 94 def accept socket, addrinfo = wait_nonblock(:accept_nonblock) [self.class._wrap(socket), Addrinfo._wrap(addrinfo)] end |
#sys_accept ⇒ Object
99 100 101 102 |
# File 'lib/lightio/library/socket.rb', line 99 def sys_accept @io_watcher.wait_readable @io.sys_accept end |