• Do you use ADB (or ScreenCopy) with Android & Windows?

    From Marion@21:1/5 to All on Mon May 5 00:32:14 2025
    Do you use ADB (or ScreenCopy) with Android & Windows?
    If so, let me know so that I can ask you a question.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Marion@21:1/5 to Arno Welzel on Fri May 9 07:10:12 2025
    On Fri, 9 May 2025 08:59:43 +0200, Arno Welzel wrote :


    Do you use ADB (or ScreenCopy) with Android & Windows?
    If so, let me know so that I can ask you a question.

    Just ask your question. If anyone can answer it, they will answer.

    Well, that's fair, where there's no sense asking the question of people who have never used adb because they can't possibly guess at the answer I seek.

    Here's the question, assuming the Android is connected via USB to the PC:
    a. When I google, adb appears to use port 5555 in most hits
    b. But on *my* system, adb clearly uses port 55555
    c. I can *see* that when I simply type "adb devices"
    C:\> adb kill-server
    C:\> adb devices
    * daemon not running; starting now at tcp:55555
    * daemon started successfully
    List of devices attached
    SMSGA325GV1 device

    So here are my questions which only someone using adb can answer.
    Q1: What port does *your* Windows adb use?
    Q2: Where is that port set inside of the adb tool?
    Q3: On Windows, what did you do to *reserve* that port?

    By way of example, here is "my" answer to those three questions:
    Q1: What port does *your* Windows adb use?
    Mine uses port 55555.
    Q2: Where is that port set inside of the adb tool?
    Hell if I know.
    Q3: On Windows, what did you do to *reserve* that port?
    C:\> netsh int ipv4 add excludedportrange protocol=tcp startport=55555 numberofports=1

    Note that my experience with adb & Windows is almost completely empirical.
    I'm trying to obtain more datapoints based on other people's experience.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Arno Welzel@21:1/5 to All on Fri May 9 08:59:43 2025
    Marion, 2025-05-05 02:32:

    Do you use ADB (or ScreenCopy) with Android & Windows?
    If so, let me know so that I can ask you a question.

    Just ask your question. If anyone can answer it, they will answer.


    --
    Arno Welzel
    https://arnowelzel.de

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Andy Burns@21:1/5 to Marion on Fri May 9 08:43:13 2025
    Marion wrote:

    So here are my questions which only someone using adb can answer.
    Q1: What port doesyour Windows adb use?

    5037

    Q2: Where is that port set inside of the adb tool?

    It's the default baked-into adb.exe

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Marion@21:1/5 to Andy Burns on Fri May 9 09:41:46 2025
    On Fri, 9 May 2025 10:27:09 +0100, Andy Burns wrote :


    where there's no sense asking the question of people who
    have never used adb because they can't possibly guess at the answer I seek.

    There's nothing special about adb or stunnel, they're just programs that
    want to listen on TCP ports, if something else already has that port
    open, they will fail, it may be unexpected that hyper-v has laid claim
    to blocks of ports, is all.

    I don't disagree where with adb most people don't mess with the port but
    with stunnel you have to pick a port for each nntp server. I use stunnel,
    by the way, because my newsreader is a bunch of scripts.

    I wonder... if I modified the scripts to use openssl instead of telnet,
    would I be able to eliminate stunnel (for example for nntp servers like
    mixmin which require encryption to post)?

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Marion@21:1/5 to Andy Burns on Fri May 9 09:34:30 2025
    On Fri, 9 May 2025 08:43:13 +0100, Andy Burns wrote :


    So here are my questions which only someone using adb can answer.
    Q1: What port doesyour Windows adb use?

    5037

    Q2: Where is that port set inside of the adb tool?

    It's the default baked-into adb.exe

    Hi Andy,

    That's what I had thought. I'm on Android 13. Windows 10.

    When I run this, it finds nothing even when adb is connected to Android.
    netstat -ano | findstr "5037"


    But when I run this, it finds the adb connection.
    netstat -ano | findstr "55555"
    TCP 127.0.0.1:8584 127.0.0.1:55555 ESTABLISHED 2668
    TCP 127.0.0.1:55555 0.0.0.0:0 LISTENING
    11968
    TCP 127.0.0.1:55555 127.0.0.1:8584 ESTABLISHED
    11968

    I guess I should have listed the version of adb, which mine may be old.
    Let me check... OK.
    adb --version
    Android Debug Bridge version 1.0.41
    Version 35.0.2-12147458
    Installed as C:\app\android\adb\adb.exe
    Running on Windows 10.0.19045

    Makes no sense (yet) why my adb uses port 55555 and nobody else's does.
    Let me look it up.... oh... oh my... geez... really?... shit....

    Apparently, while you can't change the port the adb server on your Windows machine uses for USB connections (it's fixed at 5037), you can instruct the
    adb daemon on your Android device to listen on a different port for network connections after an initial setup via USB.

    Maybe I did that looooooooooooong ago and forgot all about it?
    (I would have picked 5555+55 so it might have been me all along.)

    I forgot how I did it though... looking it upo... as we speak...

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Marion@21:1/5 to Marion on Fri May 9 09:57:14 2025
    On Fri, 9 May 2025 09:34:30 -0000 (UTC), Marion wrote :


    I forgot how I did it though... looking it upo... as we speak...

    OK. I found it. Since 55555 is just too convenient, and since 5555 is what
    adb used to use (long ago), it was almost certain I figured out a way to
    tell adb which port to use - so I had to backtrack how I managed that.

    Which means I had long ago figured out the answer to this question:

    Was...
    Q2: Where is that port set inside of the adb tool?
    Hell if I know.

    Which is now...
    Q2: Where is that port set inside of the adb tool?
    C:\> set | findstr /i adb
    ANDROID_ADB_SERVER_PORT=55555

    To test, here's what I did...
    set ANDROID_ADB_SERVER_PORT=
    adb kill-server
    cannot connect to daemon at tcp:5037:
    cannot connect to 127.0.0.1:5037:
    No connection could be made because the target machine actively refused it. (10061)

    Drat. I should have killed adb before unsetting the port.
    I opened a new window and killed adb first.

    Bingo!

    adb devices
    * daemon not running; starting now at tcp:5037
    * daemon started successfully
    List of devices attached
    SMSGA325GV1 device

    OK. So this happens to be the answer to the 3 questions...I think.
    Q1: What port does *your* Windows adb use?
    A1: TCP:5037

    Q2: Where is that port set inside of the adb tool?
    A2: setenv ANDROID_ADB_SERVER_PORT 55555
    Win+R > sysdm.cpl > Advanced > Environment Variables
    System Variables > ANDROID_ADB_SERVER_PORT

    Q3: On Windows, what did you do to *reserve* that port?
    If it's below 1024, you don't have to do anything.
    If it's above 1023, you should reserve the port using:
    C:\> netsh int ipv4 add excludedportrange protocol=tcp startport=55555 numberofports=1

    I think this solves the problem.
    Thanks.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Marion@21:1/5 to Marion on Fri May 9 10:03:16 2025
    On Fri, 9 May 2025 09:57:14 -0000 (UTC), Marion wrote :


    Q2: Where is that port set inside of the adb tool?
    C:\> set | findstr /i adb
    ANDROID_ADB_SERVER_PORT=55555

    It's sloooowly coming back to me why I set the port to 55555 so many years
    ago that I had forgotten that I had figured out how to change adb's port
    even though 5037 is hard coded (at the time, I think 5555 was hard coded).

    When Android 10 or 11 (around then sort of) came out, it allowed us to run
    adb over Wi-Fi but the damn port was dynamic so I was valiantly trying to
    find a way to be able to lock the Wi-Fi port to be static so that I didn't
    have to look at the phone every time I wanted to connect adb over Wi-Fi.

    That's almost certainly why I set that environment variable.
    It's slowly coming back to me now.

    It's rare that I fail at anything (very rare in fact), but I did fail at setting the port that adb uses over Wi-Fi to be static.

    But I had forgotten all about that failed quest.
    Sigh. I think I'm getting old.....

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Frank Slootweg@21:1/5 to Andy Burns on Fri May 9 10:12:02 2025
    Andy Burns <usenet@andyburns.uk> wrote:
    Marion wrote:

    where there's no sense asking the question of people who
    have never used adb because they can't possibly guess at the answer I seek.

    There's nothing special about adb or stunnel, they're just programs that
    want to listen on TCP ports, if something else already has that port
    open, they will fail, it may be unexpected that hyper-v has laid claim
    to blocks of ports, is all.

    Not to mention that 'Arlen' could just use 'netstat' and see for
    himself. Or am I missing something?

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Andy Burns@21:1/5 to Marion on Fri May 9 11:07:23 2025
    Marion wrote:

    When I run this, it finds nothing even when adb is connected to Android.
    C:\> netstat -ano | findstr "5037"


    But when I run this, it finds the adb connection.
    netstat -ano | findstr "55555"

    The adb server itself should listen on 5037 for client connections, the odd-numbered ports between 5555 and 5585 ought to be used as the adb
    ports belonging to emulated android devices.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Andy Burns@21:1/5 to Marion on Fri May 9 10:27:09 2025
    Marion wrote:

    where there's no sense asking the question of people who
    have never used adb because they can't possibly guess at the answer I seek.

    There's nothing special about adb or stunnel, they're just programs that
    want to listen on TCP ports, if something else already has that port
    open, they will fail, it may be unexpected that hyper-v has laid claim
    to blocks of ports, is all.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Andy Burns@21:1/5 to Marion on Fri May 9 11:12:54 2025
    Marion wrote:

    If it's above 1023, you should reserve the port using:
    C:\> netsh int ipv4 add excludedportrange protocol=tcp startport=55555 numberofports=1

    And presumably you could check the exitcode of the netsh command, and if
    it fail increment the port number and retry, finally setting the
    environment variable to the actual port number?

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Marion@21:1/5 to Frank Slootweg on Fri May 9 10:17:38 2025
    On 9 May 2025 10:12:02 GMT, Frank Slootweg wrote :


    Or am I missing something?

    Frank,

    Sometimes you act like an actual adult & sometimes you're just an asshole.
    This time, you are missing so much, it would take me weeks to clue you in.

    So stop it with your childish crap based on ignorance of the situation.
    You know absolutely nothing if you think a netstat solves the issue.

    It's demeaning for me to even have to explain this to you, Frank.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Marion@21:1/5 to Andy Burns on Fri May 9 10:21:08 2025
    On Fri, 9 May 2025 11:12:54 +0100, Andy Burns wrote :


    If it's above 1023, you should reserve the port using:
    C:\> netsh int ipv4 add excludedportrange protocol=tcp startport=55555 numberofports=1

    And presumably you could check the exitcode of the netsh command, and if
    it fail increment the port number and retry, finally setting the
    environment variable to the actual port number?

    y'mean some4thing like this?

    @echo off
    setlocal

    set "targetPort=55555"
    set "maxRetries=10"
    set "retryCount=0"

    :reservePort
    echo Trying to reserve port %targetPort%...
    netsh int ipv4 add excludedportrange protocol=tcp startport=%targetPort% numberofports=1

    if errorlevel 1 (
    echo Failed to reserve port %targetPort%. Error code: %errorlevel%
    set /a retryCount+=1
    if %retryCount% lss %maxRetries% (
    set /a targetPort+=1
    echo Retrying with port %targetPort%...
    goto :reservePort
    ) else (
    echo Failed to reserve a port after %maxRetries% retries. Exiting.
    goto :end
    )
    ) else (
    echo Successfully reserved port %targetPort%.
    echo Setting ANDROID_ADB_SERVER_PORT environment variable to %targetPort%
    setx ANDROID_ADB_SERVER_PORT %targetPort% /M
    echo Please note that system environment variables changes may require a reboot to fully take effect for all processes.
    goto :end
    )

    :end
    endlocal
    pause

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Andy Burns@21:1/5 to Marion on Fri May 9 11:49:58 2025
    Marion wrote:

    y'mean some4thing like this?

    I tried co-pilot

    "write a script to reserve an tcp port"

    it did it in Python

    "in cmd.exe"

    it wrote a one-liner using netsh

    "make it retry until it finds an available port"

    it added a loop

    "limit to ten retries"

    it obeyed

    "set resulting port in a variable"

    the result, which I haven't tried ...

    @echo off
    set /a port=8080
    set /a retries=0
    set /a max_retries=10
    set reserved_port=

    :retry
    if %retries% GEQ %max_retries% (
    echo Failed to find an available port after %max_retries% retries.
    pause
    exit /b 1
    )

    netsh int ipv4 add excludedportrange tcp %port% 1 >nul 2>&1
    if %errorlevel% == 0 (
    set reserved_port=%port%
    echo Successfully reserved TCP port %reserved_port%
    ) else (
    echo Port %port% is in use. Trying next...
    set /a port+=1
    set /a retries+=1
    goto retry
    )

    echo The reserved port is: %reserved_port%
    pause

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Andy Burns@21:1/5 to Frank Slootweg on Fri May 9 11:30:50 2025
    Frank Slootweg wrote:

    Arlen' could just use 'netstat' and see for
    himself. Or am I missing something?

    Not every port that shows up with netsh also shows with netstat, e.g.

    C:\Users\AndyC:\Users\Andy>netsh interface ipv4 show excludedportrange protocol=tcp | find /i "50060"
    50060 50159

    C:\Users\Andy>netstat -an | find ":50060"
    [nothing]

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Frank Slootweg@21:1/5 to Andy Burns on Fri May 9 14:21:57 2025
    Andy Burns <usenet@andyburns.uk> wrote:
    Frank Slootweg wrote:

    Arlen' could just use 'netstat' and see for
    himself. Or am I missing something?

    Not every port that shows up with netsh also shows with netstat, e.g.

    C:\Users\AndyC:\Users\Andy>netsh interface ipv4 show excludedportrange protocol=tcp | find /i "50060"
    50060 50159

    C:\Users\Andy>netstat -an | find ":50060"
    [nothing]

    But is (adb port) 5037 in the excluded port range? On my system,
    netstat diplays for example port 5354, which is somewhat close.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Frank Slootweg@21:1/5 to Marion on Fri May 9 14:58:37 2025
    Marion <marion@facts.com> wrote:
    On 9 May 2025 10:12:02 GMT, Frank Slootweg wrote :

    Or am I missing something?

    Frank,

    Sometimes you act like an actual adult & sometimes you're just an asshole. This time, you are missing so much, it would take me weeks to clue you in.

    So stop it with your childish crap based on ignorance of the situation.

    Keep your shirt on! I just asked *Andy* a question. *You* are
    filtered, so I see only what others quote. Andy - justifiably - quotes
    only the directly relevant part(s).

    You know absolutely nothing if you think a netstat solves the issue.

    The jury is still out on that one (see my response to Andy). And from
    what I can see, 1) at first you didn't think of netstat and 2) now *I* mentioned netstat, you didn't use the right netstat option to see if
    netstat could give you the answer.

    It's demeaning for me to even have to explain this to you, Frank.

    Given your track record, you're the last one to criticize anyone about "demeaning" material.

    But because I'm such a nice guy:

    <https://www.google.com/search?q=which+port+does+adb+use>

    *First* hit:

    "Note: All adb clients use port 5037 to communicate with the adb server.
    The server then sets up connections to all running devices. It locates
    emulators by scanning odd-numbered ports in the range 5555 to 5585,
    which is the range used by the first 16 emulators."

    From:

    'How adb works' <https://developer.android.com/tools/adb#:~:text=Note%3A%20All%20adb%20clients%20use,by%20the%20first%2016%20emulators.>

    HTH. HAND. EOD. NC.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Andy Burns@21:1/5 to Frank Slootweg on Fri May 9 15:24:47 2025
    Frank Slootweg wrote:

    But is (adb port) 5037 in the excluded port range? On my system,
    netstat diplays for example port 5354, which is somewhat close.

    If (and I'll take Arlen at his word) Hyper-V decides to pick multiple
    blocks of multiple addresses at each boot, then it could get clobbered
    some of the time ...

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Frank Slootweg@21:1/5 to Andy Burns on Fri May 9 15:18:10 2025
    Andy Burns <usenet@andyburns.uk> wrote:
    Frank Slootweg wrote:

    But is (adb port) 5037 in the excluded port range? On my system,
    netstat diplays for example port 5354, which is somewhat close.

    If (and I'll take Arlen at his word) Hyper-V decides to pick multiple
    blocks of multiple addresses at each boot, then it could get clobbered
    some of the time ...

    That could well be, but he asked *other* people "What port does *your* Windows adb use?" and those people are not likely to also use Hyper-V (nevermind that he didn't mention Hyper-V in this thread).

    And, as I showed, he didn't have to ask anybody, because the answer in
    in plain sight in Google.

    (From my aother response: <https://www.google.com/search?q=which+port+does+adb+use>
    *First* hit: <https://developer.android.com/tools/adb#:~:text=Note%3A%20All%20adb%20clients%20use,by%20the%20first%2016%20emulators.>)

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Marion@21:1/5 to Andy Burns on Fri May 9 19:15:54 2025
    On Fri, 9 May 2025 15:24:47 +0100, Andy Burns wrote :


    But is (adb port) 5037 in the excluded port range? On my system,
    netstat diplays for example port 5354, which is somewhat close.

    If (and I'll take Arlen at his word) Hyper-V decides to pick multiple
    blocks of multiple addresses at each boot, then it could get clobbered
    some of the time

    Hi Andy,

    I don't make this stuff up...
    Apparently it's well known to everyone but us. :)

    There's no official documentation, but it turns out still that it's real.

    https://github.com/microsoft/WSL/issues/5306 https://forums.docker.com/t/port-already-allocated/10888/6 https://stackoverflow.com/questions/61885607/wsl2-port-already-in-use https://dev.to/trademark18/an-attempt-was-made-to-access-a-socket-4nh9 https://www.reddit.com/r/HyperV/comments/1bowbai/port_reservation_causes_issues/
    https://stackoverflow.com/questions/54010365/how-to-see-what-is-reserving-ephemeral-port-ranges-on-windows
    https://learn.microsoft.com/en-us/answers/questions/651127/hyper-v-and-docker-desktop-preventing-port-bindin
    https://stackoverflow.com/questions/65272764/ports-are-not-available-listen-tcp-0-0-0-0-50070-bind-an-attempt-was-made-to

    (presented in order of increasing URL length)

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Marion@21:1/5 to Andy Burns on Fri May 9 20:10:58 2025
    On Fri, 9 May 2025 11:49:58 +0100, Andy Burns wrote :


    netsh int ipv4 add excludedportrange tcp %port% 1 >nul 2>&1
    if %errorlevel% == 0 (
    set reserved_port=%port%
    echo Successfully reserved TCP port %reserved_port%


    Hi Andy,

    Thanks for your purposefully helpful advice & understanding of the problem. What I learned, I suspect almost nobody knows who isn't a networking expert.

    It's been finally resolved - after years of seemingly random frustration.
    With your kind advice, the final puzzle pieces finally went into place.

    I rarely fail, so I tried valiantly years ago to set the port that adb used
    on both Android & Windows to get around Android Wi-Fi adb connect security.

    And yet, after a noble attempt at getting around that Android security
    measure, I forgot that I had set the port that adb uses (until yesterday!).

    Before setting the adb port, stunnel would also randomly fail on me
    (where I use stunnel to handle the encryption in my newsreader scripts).

    Then, at some point in time, randomly, adb would also fail to work.
    The reason it was difficult to track was that nothing was using the ports.

    And yet, adb (and stunnel) would, at times, fail to bind to their ports.
    Yet, a reboot almost always fixed it - where two reboots always fixed it.

    Worse, all the normal debugging commands (such as those Frank suggested)
    fail to find the culprit because the ports are randomly excluded; not used.

    Since few others had the same problem, there was precious little on the Internet about it, which is why I resorted to asking for help on Usenet.

    Apparently there is no official documentation, but as you're now likely
    aware, huge swathes of ports can be randomly reserved by winnat at boot.
    <https://github.com/microsoft/WSL/issues/5306>
    <https://forums.docker.com/t/port-already-allocated/10888/6>
    <https://stackoverflow.com/questions/61885607/wsl2-port-already-in-use>
    <https://dev.to/trademark18/an-attempt-was-made-to-access-a-socket-4nh9>
    <https://www.reddit.com/r/HyperV/comments/1bowbai/port_reservation_causes_issues/>
    <https://stackoverflow.com/questions/54010365/how-to-see-what-is-reserving-ephemeral-port-ranges-on-windows>
    <https://learn.microsoft.com/en-us/answers/questions/651127/hyper-v-and-docker-desktop-preventing-port-bindin>
    <https://stackoverflow.com/questions/65272764/ports-are-not-available-listen-tcp-0-0-0-0-50070-bind-an-attempt-was-made-to>

    Which you can prove yourself by stopping & restarting winnat, so not only
    is it not a mystery, it's widely known to everyone but you, me (& Frank). :)
    netsh interface ipv4 show excludedportrange protocol=tcp
    net stop winnat
    netsh interface ipv4 show excludedportrange protocol=tcp
    net start winnat
    netsh interface ipv4 show excludedportrange protocol=tcp
    If you've enabled Hyper-V, you'll see excluded ports being random!

    Which you can prove yourself by disabling & enabling Hyper-V, so not only
    is it not a mystery, it's widely known to everyone but you, me & Frank. :)
    PS:\> Get-WindowsOptionalFeature -Online -FeatureName Microsoft-Hyper-V-Hypervisor
    PS:\> netsh interface ipv4 show excludedportrange protocol=tcp
    PS:\> Disable-WindowsOptionalFeature -Online -FeatureName Microsoft-Hyper-V-All
    PS:\> netsh interface ipv4 show excludedportrange protocol=tcp
    PS:\> Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Hyper-V-All
    PS:\> netsh interface ipv4 show excludedportrange protocol=tcp
    You'll likely see a world of difference if you run those commands.

    So we've established that Hyper-V affects the available ports.
    [Note TCP, UDP, IPv4 & IPv6 are affected, but we're simplifying to TCP.]

    If that port happens to be a port you've assigned to adb or stunnel, then netstat/netsh won't show anything & yet you still can't bind to that port.
    netstat -ano | findstr :55555
    netsh interface ipv4 show tcpconnections
    (finds nothing is binding to the port)
    ncat -l -p 55555 (or... ncat -l -k -p 55555 -e exit)
    Ncat: bind to :::55555: An attempt was made to access a socket
    in a way forbidden by its access permissions. . QUITTING.
    netsh interface ipv4 show excludedportrange protocol=tcp
    (shows the port is excluded)
    ø░áC:\> netsh interface ipv4 delete excludedportrange protocol=tcp startport=55555 numberofports=1
    Access is denied.

    For Stunnel, you *must* assign a port. You have no choice.
    [Mixmin]
    client = yes
    accept = localhost:55563
    connect = news.mixmin.net:563
    CAfile = ca-certs.pem
    verifyChain = yes
    checkHost = news.mixmin.net
    OCSPaia = yes

    But for adb, you do not need to assign a port; and yet, I did but
    I had forgotten that I did that years ago when adb first came out
    as working over Wi-Fi (Android 10? Android 11? I don't remember).

    When Android came out with adb over Wi-Fi, they added security.
    I rarely fail so I tried to get around that Android security.

    As I recall (it was years ago) I made some progress in assigning
    adb ports both on Android and on Windows that were of my choosing.

    However, I was still unable to get around Android security which
    requires you to look at the Android phone to use adb over Wi-Fi.

    At that time, I gave up but it was an extremely rare failure
    since I almost never fail - but what I didn't do was reset the
    adb ports back to what they originally were before my quest.

    The reason was that everything worked just fine.

    It's only at some random boot weeks later, maybe months later,
    that adb failed to bind to the port, where, since stunnel had
    failed to bind to its ports, I didn't associate with the fact
    that I had changed the port that ADB uses on Android & Windows.

    And, since a reboot fixed it, I *thought* it was due to some
    Microsoft update (since my machine always reboots after updates).

    As you know from the reference threads on the Windows ngs, it wasn't
    Microsoft after all. Nor was it adb. Nor was it stunnel.

    It was Hyper-V.
    Sigh.
    *After years of reboots - I finally solved random port exclusions*
    <https://www.novabbs.com/computers/article-flat.php?id=87044&group=alt.comp.os.windows-10#87044>

    *Warning: If you use adb or stunnel & if you enable Hyper-V*
    <https://www.novabbs.com/computers/article-flat.php?id=87110&group=alt.comp.os.windows-10#87110>

    To prevent this from happening to others, my (now astute) recommendation is that any time you feel you need to assign a port, you should also reserve
    that port at the time you assign it (for example, as with your script).

    In summary, the problem has been solved where what I learned was
    that Hyper-V will exclude random blocks of ports, but I realize
    most people won't be affected if they don't have a need to assign ports.

    I had a need to assign ports for two reasons most people won't have:
    1. I was trying to get around Android adb Wi-Fi security, and,
    2. My newsreader was written years ago from scratch with telnet.

    To bring things to full circle, I think you and I, long ago, had
    discussed the new adb over Wi-Fi security restrictions, which means
    what started the adb port permission problem has come full circle
    with this thread, years later, which shows possible repercussions
    when you try to subvert Android adb Wi-Fi security by changing ports.
    *Do you use ADB (or ScreenCopy) with Android & Windows?*
    <https://www.novabbs.com/computers/article-flat.php?id=58842&group=comp.mobile.android#58842>

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Marion@21:1/5 to Frank Slootweg on Fri May 9 21:22:14 2025
    On 9 May 2025 15:18:10 GMT, Frank Slootweg wrote :


    And, as I showed, he didn't have to ask anybody, because the answer in
    in plain sight in Google.

    And yet that answer is wrong, Frank.

    That's where your attitude is compounded by your ignorance.

    Every post you made to this thread subtracted value.

    You know absolutely nothing about ADB. That's obvious.

    But that's not what makes you an asshole Frank.
    Your attitude is what makes you an asshole Frank.

    I don't mind you being ignorant Frank, but I do call you out when you're an asshole; if you don't want me to do that - simply stop being an asshole.

    I read *everything* you write, Frank. I always have. For many years.
    When you act like an adult, Frank - I'll treat you like an adult.

    The record clearly shows that.
    Act like an adult, Frank - and we'll get along just fine.

    Act like an asshole, Frank - and I'll call you out on it.
    I'm not random.

    You can predict my response ten years in advance Frank.
    I treat you the way you treat me.

    Think about that.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Marion@21:1/5 to Frank Slootweg on Fri May 9 21:15:36 2025
    On 9 May 2025 14:58:37 GMT, Frank Slootweg wrote :


    "Note: All adb clients use port 5037 to communicate with the adb server.
    The server then sets up connections to all running devices. It locates
    emulators by scanning odd-numbered ports in the range 5555 to 5585,
    which is the range used by the first 16 emulators."

    From:

    'How adb works' <https://developer.android.com/tools/adb#:~:text=Note%3A%20All%20adb%20clients%20use,by%20the%20first%2016%20emulators.>

    Frank,

    My problem with you is your attitude.
    Sometimes you are an asshole. Sometimes you're not an asshole.

    It's random for you.
    I react to you the way you unilaterally talk about me, Frank.

    I'm a mirror of your own attitude.
    Don't forget that.

    The record will show that my reaction to you is not random in that I react
    to you being an adult as befitting an adujlt conversation. And yet, when
    you are an asshole, Frank - I treat you like you are. Remember that.

    It's *always* you unilaterally being the asshole first, Frank.

    Think about that.
    It's been decades so you should figure that out by now.

    When you are being an asshole - I tell it to you Frank.
    You don't like that. Sure. But then don't be an asshole Frank.

    You know NOTHING about this problem set Frank.
    You being an asshole is compounded by your utter ignrance, Frank.

    So cut the crap, Frank.
    Act like an adult.

    You're wrong that you can't change the port that ADB uses, Frank.

    I already proved you can assign the port that ADB uses, which I had done,
    years ago, in an attempt to get around Android adb Wi-Fi security in around Android 10/11 time frames.
    C:\> set | findstr /i adb
    ANDROID_ADB_SERVER_PORT=55555

    To test if that was why adb was using port 55555, here's what I did...
    set ANDROID_ADB_SERVER_PORT=

    Bingo!

    Now adb on Windows is using the port that everyone else sees it using!
    adb devices
    * daemon not running; starting now at tcp:5037
    * daemon started successfully
    List of devices attached
    SMSGA325GV1 device

    OK. So this happens to be the answer to the 3 questions...I think.
    Q1: What port does *your* Windows adb use?
    A1: TCP:5037 (by default, unless you change it, which you can)

    Q2: Where is that port set inside of the Windows adb tool?
    A2: If you need to change the adb default, you can use:
    C:\> setenv ANDROID_ADB_SERVER_PORT 55555
    Win+R > sysdm.cpl > Advanced > Environment Variables
    System Variables > ANDROID_ADB_SERVER_PORT

    Q3: On Windows, what did you do to *reserve* that port?
    If it's below 1024, you don't have to do anything.
    If it's above 1023, and it's TCP, you should reserve the port.
    C:\> netsh int ipv4 add excludedportrange protocol=tcp startport=55555 numberofports=1
    [Note: Winnat with UDP uses a different set of random ports.]

    If you do not reserve any port above the privileged ports,
    for TCP (it's a different set for UDP) then you'll be sorry
    if you also turn on Hyper-V (which Docker & WSL might do).

    I consider this technical problem resolved with this information.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)