'how does adb find the emulator?

After starting an emulator instance, I can use adb to control it. But i don't need to specify the listening port of the emulator. My question is how does them connect together? Use default port? or something else.



Solution 1:[1]

It scans the even numbered ports starting at a specific range and attempts to connect. The emulator takes control of a port each.

Basically as said on http://developer.android.com/guide/developing/tools/emulator.html In the network -port section it says

The console port number must be an even integer between 5554 and 5584, inclusive. +1 must also be free and will be reserved for ADB

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Kurru