Class: EventMachine::EvmaTCPServer

### Home Classes Methods

### In Files

- lib/em/pure_ruby.rb

### Parent

EventMachine::Selectable

### Methods

- ::new
- ::start_server
- #eventable_read
- #schedule_close
- #select_for_reading?

### Files

- ChangeLog
- DEFERRABLES
- EPOLL
- INSTALL
- KEYBOARD
- LEGAL
- LIGHTWEIGHT_CONCURRENCY
- PURE_RUBY
- RELEASE_NOTES
- SMTP
- SPAWNED_PROCESSES
- TODO

### Class/Module Index

Quicksearch

- EventMachine
- EventMachine
- EventMachine::Channel
- EventMachine::Completion
- EventMachine::Connection
- EventMachine::DNS
- EventMachine::DNS::Request
- EventMachine::DNS::RequestIdAlreadyUsed
- EventMachine::DNS::Resolver
- EventMachine::DNS::Socket
- EventMachine::DatagramObject
- EventMachine::DefaultDeferrable
- EventMachine::Deferrable
- EventMachine::DeferrableChildProcess
- EventMachine::Error
- EventMachine::EvmaKeyboard
- EventMachine::EvmaTCPClient
- EventMachine::EvmaTCPServer
- EventMachine::EvmaUDPSocket
- EventMachine::EvmaUNIXClient
- EventMachine::EvmaUNIXServer
- EventMachine::FileNotFoundException
- EventMachine::FileStreamer
- EventMachine::FileWatch
- EventMachine::Iterator
- EventMachine::LoopbreakReader
- EventMachine::PeriodicTimer
- EventMachine::Pool
- EventMachine::ProcessWatch
- EventMachine::Protocols
- EventMachine::Protocols
- EventMachine::Protocols::HeaderAndContentProtocol
- EventMachine::Protocols::HttpClient
- EventMachine::Protocols::HttpClient2
- EventMachine::Protocols::HttpClient2::Request
- EventMachine::Protocols::LineAndTextProtocol
- EventMachine::Protocols::LineProtocol
- EventMachine::Protocols::LineText2
- EventMachine::Protocols::Memcache
- EventMachine::Protocols::Memcache::ParserError
- EventMachine::Protocols::ObjectProtocol
- EventMachine::Protocols::Postgres3
- EventMachine::Protocols::SASLauth
- EventMachine::Protocols::SASLauthclient
- EventMachine::Protocols::SmtpClient
- EventMachine::Protocols::SmtpServer
- EventMachine::Protocols::Socks4
- EventMachine::Protocols::Stomp
- EventMachine::Protocols::Stomp::Message
- EventMachine::Protocols::TcpConnectTester
- EventMachine::Queue
- EventMachine::Reactor
- EventMachine::Selectable
- EventMachine::SpawnedProcess
- EventMachine::StreamObject
- EventMachine::SystemCmd
- EventMachine::ThreadedResource
- EventMachine::TickLoop
- EventMachine::Timer
- EventMachine::UuidGenerator
- EventMachine::YieldBlockFromSpawnedProcess
- Object
- Object::EM
- Object::P
- BufferedTokenizer
- IO
- StringIO
- TestConnection

No matching classes.

# EventMachine::EvmaTCPServer

@private

### Public Class Methods

new(io) click to toggle source

    # File lib/em/pure_ruby.rb, line 790
    def initialize io
      super io
    end

start_server(host, port) click to toggle source

Versions of ruby 1.8.4 later than May 26 2006 will work properly with an object of type TCPServer. Prior versions won't so we play it safe and just build a socket.

    # File lib/em/pure_ruby.rb, line 781
    def start_server host, port
      sd = Socket.new( Socket::AF_INET, Socket::SOCK_STREAM, 0 )
      sd.setsockopt( Socket::SOL_SOCKET, Socket::SO_REUSEADDR, true )
      sd.bind( Socket.pack_sockaddr_in( port, host ))
      sd.listen( 50 ) # 5 is what you see in all the books. Ain't enough.
      EvmaTCPServer.new sd
    end

### Public Instance Methods

eventable_read() click to toggle source

    # File lib/em/pure_ruby.rb, line 803
    def eventable_read
      begin
        10.times {
          descriptor,peername = io.accept_nonblock
          sd = StreamObject.new descriptor
          EventMachine::event_callback uuid, ConnectionAccepted, sd.uuid
        }
      rescue Errno::EWOULDBLOCK, Errno::EAGAIN
      end
    end

schedule_close() click to toggle source

    # File lib/em/pure_ruby.rb, line 816
    def schedule_close
      @close_scheduled = true
    end

select_for_reading?() click to toggle source

    # File lib/em/pure_ruby.rb, line 795
    def select_for_reading?
      true
    end

[Validate]

Generated with the Darkfish Rdoc Generator 2.