• What is using Android adb port 55555 and/or 5555 on Windows

    From Andrew@andrew@spam.net to comp.mobile.android,alt.comp.os.windows-10,alt.comp.networking.connectivity on Fri Jul 19 14:14:18 2024
    From Newsgroup: comp.mobile.android

    I never fully understood networking - as I never had much problems.
    However... this happens: <https://i.postimg.cc/28n8vs1j/adb-port-55555.jpg>

    Background:
    1. I boot up the PC & I use adb every day, all day, while I'm at home.
    2. My phone is always connected by USB or Wi-Fi over adb on Windows 10.
    3. Mostly I use adb to mirror Android onto Windows when I'm at my desk.

    This way I can operate the Android phone using the Windows PC hardware (keyboard, mouse, display, speakers, microphone, clipboard).

    I shut down every night and every once in a while the adb default port is "broken" for reasons unknown to me. This happens infrequently - but it
    happens enough that I need a better debugging technique.

    Normally rebooting solves the problem but why should I not know what is
    hanging up port 55555 (adb over Wi-Fi) and/or port 5555 (adb on USB)?

    Below is the log of what you see in the screenshot.
    While a reboot will almost certainly solve it, why should I need to boot?

    Q: Do you have advice on how to fix what is using adb default ports?
    <https://i.postimg.cc/28n8vs1j/adb-port-55555.jpg>

    C:\app\editor\android\scrcpy>adb devices
    * daemon not running; starting now at tcp:55555
    could not read ok from ADB Server
    * failed to start daemon
    adb.exe: failed to check server version: cannot connect to daemon

    C:\app\editor\android\scrcpy>adb connect 192.168.1.4:55555
    * daemon not running; starting now at tcp:55555
    could not read ok from ADB Server
    * failed to start daemon
    error: cannot connect to daemon

    C:\app\editor\android\scrcpy>usb
    scrcpy 1.24 <https://github.com/Genymobile/scrcpy>
    * daemon not running; starting now at tcp:55555
    could not read ok from ADB Server
    * failed to start daemon
    error: cannot connect to daemon
    ERROR: "adb start-server" exited unexpectedly
    ERROR: Could not start adb daemon
    ERROR: Server connection failed

    C:\app\editor\android\scrcpy>scrcpy -s 192.168.1.4
    scrcpy 1.24 <https://github.com/Genymobile/scrcpy>
    * daemon not running; starting now at tcp:55555
    could not read ok from ADB Server
    * failed to start daemon
    error: cannot connect to daemon
    ERROR: "adb start-server" exited unexpectedly
    ERROR: Could not start adb daemon
    ERROR: Server connection failed

    C:\app\editor\android\scrcpy> adb connect 192.168.1.4:38287
    * daemon not running; starting now at tcp:55555
    could not read ok from ADB Server
    * failed to start daemon
    error: cannot connect to daemon

    C:\app\editor\android\scrcpy> adb pair 192.168.1.4:37011
    Enter pairing code: 253341
    * daemon not running; starting now at tcp:55555
    could not read ok from ADB Server
    * failed to start daemon
    error: cannot connect to daemon

    C:\app\editor\android\scrcpy>netstat | findstr 55555 C:\app\editor\android\scrcpy>nmap -vvv 192.168.1.4 -p 55555
    Starting Nmap 7.93 ( https://nmap.org ) at 2024-07-19 08:57 Central
    Daylight Time
    Initiating ARP Ping Scan at 08:57
    Scanning 192.168.1.4 [1 port]
    Completed ARP Ping Scan at 08:57, 0.23s elapsed (1 total hosts)
    Initiating Parallel DNS resolution of 1 host. at 08:57
    Completed Parallel DNS resolution of 1 host. at 08:57, 0.03s elapsed
    DNS resolution of 1 IPs took 0.19s. Mode: Async [#: 2, OK: 0, NX: 1, DR: 0,
    SF: 0, TR: 1, CN: 0]
    Initiating SYN Stealth Scan at 08:57
    Scanning 192.168.1.4 [1 port]
    Completed SYN Stealth Scan at 08:57, 0.07s elapsed (1 total ports)
    Nmap scan report for 192.168.1.4
    Host is up, received arp-response (0.13s latency).
    Scanned at 2024-07-19 08:57:14 Central Daylight Time for 0s

    PORT STATE SERVICE REASON
    55555/tcp closed unknown reset ttl 64
    MAC Address: 3E:56:75:5C:0C:DB (Unknown)

    Read data files from: C:\app\network\scanner\nmap
    Nmap done: 1 IP address (1 host up) scanned in 0.93 seconds
    Raw packets sent: 2 (72B) | Rcvd: 2 (68B)
    --- Synchronet 3.20a-Linux NewsLink 1.114
  • From Arno Welzel@usenet@arnowelzel.de to comp.mobile.android,alt.comp.os.windows-10,alt.comp.networking.connectivity on Sun Jul 21 13:39:04 2024
    From Newsgroup: comp.mobile.android

    Andrew, 2024-07-19 16:14:

    I never fully understood networking - as I never had much problems. However... this happens: <https://i.postimg.cc/28n8vs1j/adb-port-55555.jpg>

    Background:
    1. I boot up the PC & I use adb every day, all day, while I'm at home.
    2. My phone is always connected by USB or Wi-Fi over adb on Windows 10.
    3. Mostly I use adb to mirror Android onto Windows when I'm at my desk.

    Depending in your Windows version, you may use netstat in an
    administrative Windows console:

    netstat -anb

    This will show all open ports and the name of the process which opened
    it. The options used:

    a - all ports, including the ones which are listening for incoming
    connections

    n - do not try to resolve names for IP addresses

    b - show the name of the process which opened the port
    --
    Arno Welzel
    https://arnowelzel.de

    --- Synchronet 3.20a-Linux NewsLink 1.114
  • From Andrew@andrew@spam.net to comp.mobile.android,alt.comp.os.windows-10,alt.comp.networking.connectivity on Sun Jul 21 13:06:23 2024
    From Newsgroup: comp.mobile.android

    Arno Welzel wrote on Sun, 21 Jul 2024 13:39:04 +0200 :

    Background:
    1. I boot up the PC & I use adb every day, all day, while I'm at home.
    2. My phone is always connected by USB or Wi-Fi over adb on Windows 10.
    3. Mostly I use adb to mirror Android onto Windows when I'm at my desk.

    Depending in your Windows version, you may use netstat in an
    administrative Windows console:

    netstat -anb

    This will show all open ports and the name of the process which opened
    it. The options used:

    a - all ports, including the ones which are listening for incoming connections

    n - do not try to resolve names for IP addresses

    b - show the name of the process which opened the port

    Thanks Arno for your kind suggestion, which I've added to my syslog.
    Win+R > syslog [Enter] <== syslog is in the AppPaths registry key

    I've since rebooted, so whatever was holding on to 55555 has released. Rebooting almost always, if not always works - which is why it's odd.

    I ran the command without adb connections:
    1. Win+R > netstat -anb [Ctrl+Shift+Enter] <== to open an admin window
    2. netstat -anb | findstr 5555
    3. Which reported:
    TCP 127.0.0.1:55555 0.0.0.0:0 LISTENING

    I ran the command with the phone connected by adb over USB:
    C:\app\editor\android\scrcpy> scrcpy -s 192.168.1.4 <== mirrors Android
    C:\app\editor\android\sndcpy <== this uses the PC's speakers instead
    Waiting for device...
    Performing Streamed Install
    Success
    32961
    Starting: Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] cmp=com.rom1v.sndcpy/.MainActivity }
    Waiting for 0 seconds, press a key to continue ...
    Playing audio...
    C:\Windows\system32> netstat -anb | findstr 5555
    TCP 127.0.0.1:11023 127.0.0.1:55555 ESTABLISHED
    TCP 127.0.0.1:55555 0.0.0.0:0 LISTENING
    TCP 127.0.0.1:55555 127.0.0.1:11012 TIME_WAIT
    TCP 127.0.0.1:55555 127.0.0.1:11013 TIME_WAIT
    TCP 127.0.0.1:55555 127.0.0.1:11014 TIME_WAIT
    TCP 127.0.0.1:55555 127.0.0.1:11015 TIME_WAIT
    TCP 127.0.0.1:55555 127.0.0.1:11016 TIME_WAIT
    TCP 127.0.0.1:55555 127.0.0.1:11017 TIME_WAIT
    TCP 127.0.0.1:55555 127.0.0.1:11019 TIME_WAIT
    TCP 127.0.0.1:55555 127.0.0.1:11020 TIME_WAIT
    TCP 127.0.0.1:55555 127.0.0.1:11021 TIME_WAIT
    TCP 127.0.0.1:55555 127.0.0.1:11022 TIME_WAIT
    TCP 127.0.0.1:55555 127.0.0.1:11023 ESTABLISHED
    TCP 127.0.0.1:55555 127.0.0.1:11027 TIME_WAIT
    TCP 127.0.0.1:55555 127.0.0.1:11028 TIME_WAIT

    And I ran the command with the phone connected by adb over Wi-Fi
    (using the Wireless Debugging Tile that came with Android 10+)
    C:\app\editor\android\scrcpy> adb connect 192.168.1.4:42643
    connected to 192.168.1.4:42643
    C:\app\editor\android\scrcpy> scrcpy -s 192.168.1.4
    scrcpy 1.24 <https://github.com/Genymobile/scrcpy>
    C:\app\editor\android\scrcpy\scrcpy-server: 1 file pushed, 0 skipped. 25.0 MB/s (41159 bytes in 0.002s)
    [server] INFO: Device: samsung SM-A326U (Android 13)
    INFO: Renderer: direct3d
    INFO: Initial texture: 720x1600
    C:\Windows\system32> netstat -anb | findstr 5555
    C:\Windows\system32> netstat -anb | findstr 5555
    TCP 127.0.0.1:55555 0.0.0.0:0 LISTENING
    TCP 127.0.0.1:55555 127.0.0.1:63998 ESTABLISHED
    TCP 127.0.0.1:63998 127.0.0.1:55555 ESTABLISHED

    The next time I get this adb error, I'll run that netstat command
    as none of the commands above showed what it shows when adb is locked.
    PORT STATE SERVICE REASON
    55555/tcp closed unknown reset ttl 64

    Much appreciated the kind help & advice even though I have no idea why the netstat command is showing all those ports when I didn't open them myself.
    --- Synchronet 3.20a-Linux NewsLink 1.114
  • From Andy Burns@usenet@andyburns.uk to comp.mobile.android,alt.comp.os.windows-10,alt.comp.networking.connectivity on Sun Jul 21 14:44:01 2024
    From Newsgroup: comp.mobile.android

    Andrew wrote:

    2. netstat -anb | findstr 5555
    3. Which reported:
    TCP 127.0.0.1:55555 0.0.0.0:0 LISTENING

    Using findstr is not useful when using netstat -nb because the name of executable is not on the same line of output as the port number you're matching.
    --- Synchronet 3.20a-Linux NewsLink 1.114
  • From Andrew@andrew@spam.net to comp.mobile.android,alt.comp.os.windows-10,alt.comp.networking.connectivity on Sun Jul 21 14:38:04 2024
    From Newsgroup: comp.mobile.android

    Andy Burns wrote on Sun, 21 Jul 2024 14:44:01 +0100 :

    2. netstat -anb | findstr 5555
    3. Which reported:
    TCP 127.0.0.1:55555 0.0.0.0:0 LISTENING

    Using findstr is not useful when using netstat -nb because the name of executable is not on the same line of output as the port number you're matching.

    Good point. If it were Linux and not Windows, it would be easier
    (as I learned UNIX well before Windows existed, like most of us here).

    Long ago I had a syntax-correct example in both Linux & Window for
    running grep/findstr that also did a cat/tail of a given number of lines *after* the match - but I've lost that syntax in the ensuing years.

    Looking it up, there are many people trying to reproduce grep on Windows,
    and yes, like everyone, I've used the CYGWIN & WSL Frankenstein shells. https://superuser.com/questions/300815/grep-equivalent-for-windows-7

    Taking your kind & helpful advice into hand, what I'll do is pipe the
    standard out results to a file and then I can search using Vim (which is my default text editor since my finger memory has lasted for many decades).

    Much appreciated.
    --- Synchronet 3.20a-Linux NewsLink 1.114
  • From Andy Burns@usenet@andyburns.uk to comp.mobile.android,alt.comp.os.windows-10,alt.comp.networking.connectivity on Sun Jul 21 16:34:22 2024
    From Newsgroup: comp.mobile.android

    Andrew wrote:

    Looking it up, there are many people trying to reproduce grep on Windows

    You can do it with powershell (still needs to be run as admin for the -b option)

    netstat -nb | select-string -pattern ":5555" -context 0,1
    --- Synchronet 3.20a-Linux NewsLink 1.114
  • From Java Jive@java@evij.com.invalid to comp.mobile.android,alt.comp.os.windows-10,alt.comp.networking.connectivity on Sun Jul 21 17:15:24 2024
    From Newsgroup: comp.mobile.android

    On 21/07/2024 15:38, Andrew wrote:

    Long ago I had a syntax-correct example in both Linux & Window for
    running grep/findstr that also did a cat/tail of a given number of lines *after* the match - but I've lost that syntax in the ensuing years.

    Well, it's not exactly hard to find, just type ...
    grep --help
    ... and it's all there:
    -B, --before-context=NUM print NUM lines of leading context
    -A, --after-context=NUM print NUM lines of trailing context
    --

    Fake news kills!

    I may be contacted via the contact address given on my website: www.macfh.co.uk
    --- Synchronet 3.20a-Linux NewsLink 1.114