Class: TCPServer

Inherits:
TCPSocket show all
Includes:
Socket::ListenAndAccept
Defined in:
lib/rubysl/socket/socket.rb

Constant Summary

Constants inherited from TCPSocket

TCPSocket::FFI

Constants inherited from BasicSocket

BasicSocket::FFI

Instance Method Summary collapse

Methods included from Socket::ListenAndAccept

#accept, #accept_nonblock, #accept_nonblock2, #listen

Methods inherited from TCPSocket

#from_descriptor, gethostbyname, #send

Methods inherited from IPSocket

#addr, getaddress, #peeraddr, #recvfrom, #recvfrom_nonblock

Methods inherited from BasicSocket

#close_read, #close_write, do_not_reverse_lookup, do_not_reverse_lookup=, for_fd, from_descriptor, #from_descriptor, #getpeername, #getsockname, #getsockopt, #recv, #recv_nonblock, #recvfrom, #send, #setsockopt, #shutdown

Constructor Details

#initialize(host, port = nil) ⇒ TCPServer

Returns a new instance of TCPServer.



1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
# File 'lib/rubysl/socket/socket.rb', line 1191

def initialize(host, port = nil)
  if Fixnum === host and port.nil? then
    port = host
    host = nil
  end

  if String === host and port.nil? then
    port = Integer(host)
    host = nil
  end

  port = StringValue port unless port.kind_of? Fixnum

  @host = host
  @port = port

  tcp_setup @host, @port, nil, nil, true
end