### Home Classes Methods

### In Files

- lib/cool.io/socket.rb

### Parent

IOWatcher

### Methods

- ::new
- #on_writable

### 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::Socket::Connector

### Public Class Methods

new(coolio_socket, ruby_socket) click to toggle source

    # File lib/cool.io/socket.rb, line 58
    def initialize(coolio_socket, ruby_socket)
      @coolio_socket, @ruby_socket = coolio_socket, ruby_socket
      super(ruby_socket, :w)
    end

### Public Instance Methods

on_writable() click to toggle source

    # File lib/cool.io/socket.rb, line 63
    def on_writable
      evl = evloop
      detach

      if connect_successful?
        @coolio_socket.instance_eval { @_connector = nil }
        @coolio_socket.attach(evl)
        @ruby_socket.setsockopt(::Socket::IPPROTO_TCP, ::Socket::TCP_NODELAY, [1].pack("l"))
        @ruby_socket.setsockopt(::Socket::SOL_SOCKET, ::Socket::SO_KEEPALIVE, true)

        @coolio_socket.__send__(:on_connect)
      else
        @coolio_socket.instance_eval { @_failed = true }
        @coolio_socket.__send__(:on_connect_failed)
      end
    end

[Validate]

Generated with the Darkfish Rdoc Generator 2.