原文地址
http://developer.android.com/guide/developing/tools/adb.html
Android Debug Bridge
Android调试桥
Android Debug Bridge (adb) is a versatile tool lets you manage the state of an emulator instance or Android-powered device. It is a client-server program that includes three components:
Android调试桥(adb)是让你管理模拟器实例或者装有Android的设备的通用工具。它是包含三个模块的基于客户端/服务器模式的程序。
A client, which runs on your development machine. You can invoke a client from a shell by issuing an adb command. Other Android tools such as the ADT plugin and DDMS also create adb clients.
客户端,运行在你的开发机器上。你可以通过输入adb命令调用客户端。其它的Android工具,比如:ADT插件和DDMS也创建adb客户端。
A server, which runs as a background process on your development machine. The server manages communication between the client and the adb daemon running on an emulator or device.
A daemon, which runs as a background process on each emulator or device instance.
When you start an adb client, the client first checks whether there is an adb server process already running. If there isn't, it starts the server process. When the server starts, it binds to local TCP port 5037 and listens for commands sent from adb clients—all adb clients use port 5037 to communicate with the adb server.
服务端,运行在你的开发机器上的后台的进程中。服务端管理客户端和运行在模拟器或者设备上的adb deamon(守护进程?)。
Deamon,运行在每个模拟器或者设备实例上的后台进程中。当你启动一个adb客户端,客户端首先检查adb服务端是否已经运行。如果没有,它就启动服务进程。当服务端启动时,它绑定本地的TCP端口5037,并且侦听从adb客户端发送来的命令——所有的客户端使用端口5037和adb服务器通信。
The server then sets up connections to all running emulator/device instances. It locates emulator/device instances by scanning odd-numbered ports in the range 5555 to 5585, the range used by emulators/devices. Where the server finds an adb daemon, it sets up a connection to that port. Note that each emulator/device instance acquires a pair of sequential ports — an even-numbered port for console connections and an odd-numbered port for adb connections. For example:
于是,服务端和所有运行的模拟器/设备实例建立连接。它通过扫描从5555到5585之间的奇数号端口来定位模拟器/设备实例。服务端可以在这里面找到adb deamon的端口,它建立起到这个端口的连接。请注意,每个模拟器/设备实例获得一对连续的端口——偶数端口用来控制连接,奇数端口用来adb连接。例如:
Emulator 1, console: 5554
Emulator 1, adb: 5555
Emulator 2, console: 5556
Emulator 2, adb: 5557 ...
As shown, the emulator instance connected to adb on port 5555 is the same as the instance whose console listens on port 5554.
如上面所示,连接到端口5555的模拟器实例和控制台侦听在端口5554的实例是一样的。
Once the server has set up connections to all emulator instances, you can use adb commands to control and access those instances. Because the server manages connections to emulator/device instances and handles commands from multiple adb clients, you can control any emulator/device instance from any client (or from a script).
一旦服务端在所有的模拟器实例之间建立起连接,你可以通过adb命令控制和获取那些实例。由于服务端管理模拟器/设备实例和处理多个adb客户端的命令,因此你能通过客户端(或者脚本)控制任何模拟器/设备实例。
The sections below describe the commands that you can use to access adb capabilities and manage the state of an emulator/device. Note that if you are developing Android applications in Eclipse and have installed the ADT plugin, you do not need to access adb from the command line. The ADT plugin provides a trasparent integration of adb into the Eclipse IDE. However, you can still use adb directly as necessary, such as for debugging.
下面几节描述了命令,这样你可以使用adb工具和管理模拟器/设备的状态。请注意,如果你在Eclipse下开发Android应用程序,且安装了ADT插件,你就没必要通过命令行访问adb。ADT插件将adb透明的集成到Eclipse IDE中。然而,你仍然可以按需直接使用adb,例如:调试。