# class Byebug::Remote::Client

Client for remote debugging

### Attributes

interface[R]
socket[R]

### Public Class Methods

new(interface) click to toggle source

    # File lib/byebug/remote/client.rb, line 13
    def initialize(interface)
      @interface = interface
      @socket = nil
    end

### Public Instance Methods

start(host = "localhost", port = PORT) click to toggle source

Connects to the remote byebug

    # File lib/byebug/remote/client.rb, line 21
    def start(host = "localhost", port = PORT)
      connect_at(host, port)

      while (line = socket.gets)
        case line
        when /^PROMPT (.*)$/
          input = interface.read_command(Regexp.last_match[1])
          break unless input

          socket.puts input
        when /^CONFIRM (.*)$/
          input = interface.readline(Regexp.last_match[1])
          break unless input

          socket.puts input
        else
          interface.puts line
        end
      end

      socket.close
    end

started?() click to toggle source

    # File lib/byebug/remote/client.rb, line 44
    def started?
      !socket.nil?
    end

### Private Instance Methods

connect_at(host, port) click to toggle source

    # File lib/byebug/remote/client.rb, line 50
    def connect_at(host, port)
      interface.puts "Connecting to byebug server at #{host}:#{port}..."
      @socket = TCPSocket.new(host, port)
      interface.puts "Connected."
    end