### Home Classes Methods

### In Files

- lib/cool.io/listener.rb

### Parent

Coolio::Listener

### Methods

- ::new

### Class/Module Index

Quicksearch

- Coolio
- Coolio::AsyncWatcher
- Coolio::Connections
- Coolio::DNSResolver
- Coolio::DNSResolver::Timeout
- Coolio::DSL
- Coolio::DSL::ConnectionBuilder
- Coolio::IO
- Coolio::IO::Watcher
- Coolio::IOWatcher
- Coolio::Listener
- Coolio::Loop
- Coolio::Meta
- Coolio::Server
- Coolio::Socket
- Coolio::Socket::Connector
- Coolio::TCPListener
- Coolio::TCPServer
- Coolio::TCPSocket
- Coolio::TCPSocket::TCPConnectResolver
- Coolio::TCPSocket::TCPConnectSocket
- Coolio::TimerWatcher
- Coolio::UNIXListener
- Coolio::UNIXServer
- Coolio::UNIXSocket
- Cool
- Cool::Coolness
- Cool::IOThunk
- Object
- Thread

No matching classes.

# Coolio::TCPListener

### Public Class Methods

new(addr, port = nil, options = {}) click to toggle source

Create a new Coolio::TCPListener on the specified address and port. Accepts the following options:

    :backlog - Max size of the pending connection queue (default 1024)
    :reverse_lookup - Retain BasicSocket's reverse DNS functionality (default false)

If the specified address is an TCPServer object, it will ignore the port and :backlog option and create a new Coolio::TCPListener out of the existing TCPServer object.

    # File lib/cool.io/listener.rb, line 72
    def initialize(addr, port = nil, options = {})
      BasicSocket.do_not_reverse_lookup = true unless options[:reverse_lookup]
      options[:backlog] ||= DEFAULT_BACKLOG

      listen_socket = if ::TCPServer === addr
        addr
      else
        raise ArgumentError, "port must be an integer" if nil == port
        ::TCPServer.new(addr, port)
      end
      listen_socket.instance_eval { listen(options[:backlog]) }
      super(listen_socket)
    end

[Validate]

Generated with the Darkfish Rdoc Generator 2.