Class: TCPServer

Inherits:
TCPSocket show all
Includes:
Socket::ListenAndAccept
Defined in:
lib/rubysl/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, #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, 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.



1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
# File 'lib/rubysl/socket.rb', line 1499

def initialize(host, port = nil)
  @no_reverse_lookup = self.class.do_not_reverse_lookup

  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