Class: TCPServer

Inherits:
TCPSocket show all
Defined in:
lib/framework/autocomplete/TCPServer.rb,
lib/framework/_socket.rb

Overview

It is auto-generated content. Do not do required for this file in your application.

Defined Under Namespace

Modules: WaitReadable, WaitWritable

Constant Summary collapse

SEEK_SET =
0
SEEK_CUR =
1
SEEK_END =
2
LOCK_SH =
1
LOCK_EX =
2
LOCK_UN =
8
LOCK_NB =
4
RDONLY =
0
WRONLY =
1
RDWR =
2
APPEND =
8
CREAT =
256
EXCL =
1024
NONBLOCK =
4
TRUNC =
512
BINARY =
32768
FNM_NOESCAPE =
1
FNM_PATHNAME =
2
FNM_DOTMATCH =
4
FNM_CASEFOLD =
8
FNM_SYSCASE =
8

Instance Method Summary collapse

Methods inherited from TCPSocket

gethostbyname

Instance Method Details

#acceptObject



56
57
# File 'lib/framework/autocomplete/TCPServer.rb', line 56

def accept
end

#accept_nonblockObject

call-seq:

tcpserver.accept_nonblock([options]) => tcpsocket

Accepts an incoming connection using accept(2) after O_NONBLOCK is set for the underlying file descriptor. It returns an accepted TCPSocket for the incoming connection.

Example

require ‘socket’ serv = TCPServer.new(2202) begin # emulate blocking accept sock = serv.accept_nonblock rescue IO::WaitReadable, Errno::EINTR IO.select() retry end # sock is an accepted socket.

Refer to Socket#accept for the exceptions that may be thrown if the call to TCPServer#accept_nonblock fails.

TCPServer#accept_nonblock may raise any error corresponding to accept(2) failure, including Errno::EWOULDBLOCK.

If the exception is Errno::EWOULDBLOCK, Errno::EAGAIN, Errno::ECONNABORTED, Errno::EPROTO, it is extended by IO::WaitReadable. So IO::WaitReadable can be used to rescue the exceptions for retrying accept_nonblock.

By specifying ‘exception: false`, the options hash allows you to indicate that accept_nonblock should not raise an IO::WaitReadable exception, but return the symbol :wait_readable instead.

See

  • TCPServer#accept

  • Socket#accept



1306
1307
1308
# File 'lib/framework/_socket.rb', line 1306

def accept_nonblock(exception: true)
  __accept_nonblock(exception)
end

#listen(req) ⇒ Object



62
63
# File 'lib/framework/autocomplete/TCPServer.rb', line 62

def listen(req)
end

#sysacceptObject



60
61
# File 'lib/framework/autocomplete/TCPServer.rb', line 60

def sysaccept
end