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 read_input
		rary = []
		self.ibuffer << self.socket.sysread( MTU )
		while (( pos = self.ibuffer.index(EOL) ))
			rary << self.ibuffer.slice!( 0, pos )
			self.ibuffer.lstrip!
		end
		return rary
	rescue EOFError, SystemCallError
		@server.disconnect_user( self )
		return []
	end
def read_input rary = [ ] self . ibuffer << self . socket . sysread ( MTU ) while ( ( pos = self . ibuffer . index ( EOL ) ) ) rary << self . ibuffer . slice! ( 0 , pos ) self . ibuffer . lstrip! end return rary rescue EOFError , SystemCallError @server . disconnect_user ( 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 .
# Extract any complete input lines from the input buffer by # slicing off chunks delimited by EOL # If there was a socket error, disconnect