examples/chatserver.rb
def handle_poll_event( socket, event )
		$stderr.puts "Got #{event.inspect} event for #{socket.inspect}"

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

		when :read
			client_sock = socket.accept
			user        = Example::User.new( client_sock, self )

			$stderr.puts "Accepted connection from #{user}"
			@reactor.register( client_sock, :read, &user.method(:handle_io_event) )
			user.add_output( BANNER )
			user.prompt

			self.broadcast_msg( "[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 handle_poll_event( socket, event )
		$stderr.puts "Got #{event.inspect} event for #{socket.inspect}"
		case event
		when :error
			$stderr.puts "Socket error on the listener socket."
			self.shutdown
		when :read
			client_sock = socket.accept
			user        = Example::User.new( client_sock, self )
			$stderr.puts "Accepted connection from #{user}"
			@reactor.register( client_sock, :read, &user.method(:handle_io_event) )
			user.add_output( BANNER )
			user.prompt
			self.broadcast_msg( "[New connection: #{user}]" )
			@users << user
		end
	end
def handle_poll_event ( socket , event ) $stderr . puts "Got #{event.inspect} event for #{socket.inspect}" case event when :error $stderr . puts "Socket error on the listener socket." self . shutdown when :read client_sock = socket . accept user = Example :: User . new ( client_sock , self ) $stderr . puts "Accepted connection from #{user}" @reactor . register ( client_sock , :read , & user . method ( :handle_io_event ) ) user . add_output ( BANNER ) user . prompt self . broadcast_msg ( "[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