vendor/bundle/ruby/1.8/gems/io-reactor-1.0.4/examples/chatserver.rb
def handlePollEvent( socket, event )
		$stderr.puts "Got #{event.inspect} event for #{socket.inspect}"

		case event
		when :error
			$stderr.puts "Socket error on the listener socket."
			shutdown()

		when :read
			clSock = socket.accept
			user = User::new( clSock, self )
			$stderr.puts "Accepted connection from #{user}"
			@reactor.register clSock, :read, &user.method(:handleIOEvent)
			user.addOutput( BANNER )
			user.prompt
			broadcastMsg( "[New connection: #{user}]" )
			@users << user

		end
	end
### Handle a poll event specified by <tt>event</tt> on the specified
### <tt>socket</tt>
Handle a poll event specified by event on the specified
socket
Handle a poll event specified by event on the specified socket
def handlePollEvent( socket, event )
		$stderr.puts "Got #{event.inspect} event for #{socket.inspect}"
		case event
		when :error
			$stderr.puts "Socket error on the listener socket."
			shutdown()
		when :read
			clSock = socket.accept
			user = User::new( clSock, self )
			$stderr.puts "Accepted connection from #{user}"
			@reactor.register clSock, :read, &user.method(:handleIOEvent)
			user.addOutput( BANNER )
			user.prompt
			broadcastMsg( "[New connection: #{user}]" )
			@users << user
		end
	end
def handlePollEvent ( socket , event ) $stderr . puts "Got #{event.inspect} event for #{socket.inspect}" case event when :error $stderr . puts "Socket error on the listener socket." shutdown ( ) when :read clSock = socket . accept user = User :: new ( clSock , self ) $stderr . puts "Accepted connection from #{user}" @reactor . register clSock , :read , & user . method ( :handleIOEvent ) user . addOutput ( BANNER ) user . prompt broadcastMsg ( "[New connection: #{user}]" ) @users << user end end
Handle a poll event specified by <tt>event</tt> on the specified
<tt>socket</tt>
Handle a poll event specified by <tt > event< / tt > on the specified <tt > socket< / tt >
socket
event