        # File lib/protocols/line_and_text.rb, line 43
    43:       def receive_data data
    44:         if @lbp_mode == :lines
    45:           begin
    46:             @lpb_buffer.extract(data).each do |line|
    47:               receive_line(line.chomp) if respond_to?(:receive_line)
    48:             end
    49:           rescue Exception
    50:             receive_error('overlength line') if respond_to?(:receive_error)
    51:             close_connection
    52:             return
    53:           end
    54:         else
    55:           if @lbp_binary_limit > 0
    56:             wanted = @lbp_binary_limit - @lbp_binary_bytes_received
    57:             chunk = nil
    58:             if data.length > wanted
    59:               chunk = data.slice!(0...wanted)
    60:             else
    61:               chunk = data
    62:               data = ""
    63:             end
    64:             @lbp_binary_buffer[@lbp_binary_bytes_received...(@lbp_binary_bytes_received+chunk.length)] = chunk
    65:             @lbp_binary_bytes_received += chunk.length
    66:             if @lbp_binary_bytes_received == @lbp_binary_limit
    67:               receive_binary_data(@lbp_binary_buffer) if respond_to?(:receive_binary_data)
    68:               lbp_init_line_state
    69:             end
    70:             receive_data(data) if data.length > 0
    71:           else
    72:             receive_binary_data(data) if respond_to?(:receive_binary_data)
    73:             data = ""
    74:           end
    75:         end
    76:       end