### Home Classes Methods

### In Files

- lib/cool.io/server.rb

### Parent

Coolio::Server

### 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::TCPServer

TCP server class. Listens on the specified host and port and creates new connection objects of the given class. This is the most common server class. Note that the new connection objects will be bound by default to the same event loop that the server is attached to. Optionally, it can also take any existing core TCPServer object as `host` and create a Coolio::TCPServer out of it.

### Public Class Methods

new(host, port = nil, klass = TCPSocket, *args, &block) click to toggle source

    # File lib/cool.io/server.rb, line 52
    def initialize(host, port = nil, klass = TCPSocket, *args, &block)
      listen_socket = if ::TCPServer === host
        host
      else
        raise ArgumentError, "port must be an integer" if nil == port
        ::TCPServer.new(host, port)
      end
      listen_socket.instance_eval { listen(DEFAULT_BACKLOG) } # Change listen backlog to 1024
      super(listen_socket, klass, *args, &block)
    end

[Validate]

Generated with the Darkfish Rdoc Generator 2.