-# Persistant connection to the debugger
-# Default port = 22125
-#
-class DebugClient
-
- var debugger_connection: Socket
-
- init (host: String, port: Int)
- do
- self.debugger_connection = new Socket.stream_with_host(host, port)
- print "[HOST ADDRESS] : "+debugger_connection.address
- print "[HOST] : "+debugger_connection.host.as(not null)
- print "[PORT] : "+debugger_connection.port.to_s
- end
-
- init with_port (host: String, port: Int)
- do
- debugger_connection = new Socket.stream_with_host(host, port)
- end
-
- fun send_command(command: String)
- do
- debugger_connection.write(command+"\n")
- end
-
- fun connected: Bool
- do
- return self.debugger_connection.connected
- end
-
- fun ready: Bool
- do
- return debugger_connection.ready_to_read(40)
- end
-
- fun read_command: String
- do
- var buff = new FlatBuffer
- while debugger_connection.ready_to_read(40) do buff.append(debugger_connection.read)
- return buff.to_s
- end
-
- fun disconnect
- do
- debugger_connection.close
- end
-
-end
-