vendor/bundle/ruby/1.8/gems/io-reactor-1.0.4/examples/chatserver.rb
### Read at most MTU bytes from the socket and append them to the input
### buffer. Split off any complete lines (one that end with EOL) and return
### them as an Array of Strings.
Read at most MTU bytes from the socket and append them to the input
buffer. Split off any complete lines (one that end with EOL) and return
them as an Array of Strings.
Read at most MTU bytes from the socket and append them to the input buffer . Split off any complete lines ( one that end with EOL ) and return them as an Array of Strings .
def readInput
		rary = []
		@ibuffer << @socket.sysread( MTU )
		$stderr.puts "Input buffer for user #{self} now: #@ibuffer" if $VERBOSE
		while (( pos = @ibuffer.index EOL ))
			$stderr.puts "Found terminating EOL. "\
				"Splitting off 0..#{pos} of the input buffer." if $VERBOSE
			rary << @ibuffer[ 0, pos ]
			@ibuffer[ 0, pos + EOL.length ] = ''
		end
		return rary
	rescue EOFError
		@server.disconnectUser( self )
		return []
	end
def readInput rary = [ ] @ibuffer << @socket . sysread ( MTU ) $stderr . puts "Input buffer for user #{self} now: #@ibuffer" if $VERBOSE while ( ( pos = @ibuffer . index EOL ) ) $stderr . puts "Found terminating EOL. " "Splitting off 0..#{pos} of the input buffer." if $VERBOSE rary << @ibuffer [ 0 , pos ] @ibuffer [ 0 , pos + EOL . length ] = '' end return rary rescue EOFError @server . disconnectUser ( self ) return [ ] end
Read at most MTU bytes from the socket and append them to the input
buffer.
Read at most MTU bytes from the socket and append them to the input buffer .