# File monit/lib/symbiosis/monitor/tcpconnection.rb, line 46
        def do_check
          sock = nil
          @transactions = []
          begin
            Timeout.timeout(@timeout, Errno::ETIMEDOUT) do
              sock = self.connect
              @script.each do |line|
                if line.is_a?(String)
                  @transactions << "> "+line.chomp.inspect[1..-2]
                  puts @transactions.last
                  sock.print line
                else
                  loop do
                    trans = sock.gets
                    break if trans.nil?
                    # transform duff characters
                    @transactions << "< "+trans.chomp.inspect[1..-2]
                    puts @transactions.last
                    break if line.nil? or (line.is_a?(Regexp) and trans =~ line)
                  end
                end
              end
              sock.close
            end
          rescue => err
            raise err
          ensure
            sock.close if sock.is_a?(Socket) and not sock.closed?
          end
        end