Ejemplo n.º 1
0
        /// <summary>
        /// Disconnect from any connected VM.
        /// </summary>
        public void Disconnect()
        {
            var conn = connection;

            connection = null;
            prepared   = false;
            pid        = -1;
            var oldMonitor = jdwpMonitor;

            jdwpMonitor = null;
            if (oldMonitor != null)
            {
                oldMonitor.Stop();
                oldMonitor.Dispose();
            }

            if (conn != null)
            {
                try
                {
                    conn.Close();
                }
                catch
                {
                    // Ignore
                }
            }

            // Notify
            ConnectedChanged.Fire(this);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Connect to the VM in the given process id on the given device.
        /// </summary>
        public void Connect(IDevice device, int pid, MapFile mapFile)
        {
            // Disconnect any pending connections
            Disconnect();

            // Cleanup
            process = null;
            this.mapFile = mapFile;
            this.pid = pid;

            // Setup forward
            var port = GetFreePort();
            var adb = new Adb();
            adb.ForwardJdwp(device, port, pid);

            // Establish connection
            connection = new JdwpConnection(new IPEndPoint(IPAddress.Parse("127.0.0.1"), port), ChunkHandler, pid, PacketHandler);
            connection.Disconnect += OnConnectionDisconnect;

            // Notify
            ConnectedChanged.Fire(this);
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Connect to the VM in the given process id on the given device.
        /// </summary>
        public void Connect(IDevice device, int pid, MapFile mapFile)
        {
            // Disconnect any pending connections
            Disconnect();

            // Cleanup
            process      = null;
            this.mapFile = mapFile;
            this.pid     = pid;

            // Setup forward
            var port = GetFreePort();
            var adb  = new Adb();

            adb.ForwardJdwp(device, port, pid);

            // Establish connection
            connection             = new JdwpConnection(new IPEndPoint(IPAddress.Parse("127.0.0.1"), port), ChunkHandler, pid, PacketHandler);
            connection.Disconnect += OnConnectionDisconnect;

            // Notify
            ConnectedChanged.Fire(this);
        }
Ejemplo n.º 4
0
        /// <summary>
        /// Disconnect from any connected VM.
        /// </summary>
        public void Disconnect()
        {
            var conn = connection;
            connection = null;
            prepared = false;
            pid = -1;
            var oldMonitor = jdwpMonitor;
            jdwpMonitor = null;
            if (oldMonitor != null)
            {
                oldMonitor.Stop();
                oldMonitor.Dispose();
            }

            if (conn != null)
            {
                try
                {
                    conn.Close();
                }
                catch
                {
                    // Ignore
                }
            }

            // Notify
            ConnectedChanged.Fire(this);
        }