Search code examples
windows-11

Cannot connect to 127.0.0.1:58526 (Port shown under the Developer Mode of WSA)


As shown in the title, I can't connect to 127.0.0.1:58526 via adb. ADB showed

cannot connect to 127.0.0.1:58526: No connection could be made because the target machine actively refused it. (10061)

I checked the netstat

netstat -anep tcp | findstr "58526"

and the result showed that Port 58526 is not listening(actually, I didn't get any result) .

And of course my Developer Mode is on but I can't toggle Wireless Debugging.

BTW, I can connect to WSA by the given IP in the WSA Setting panel(i.e.:172.22.*.*:5555).

Any suggestions on solving this? Thanks!


Solution

  • so I've been able to find a solution to the issue.

    First, open a PowerShell window and run

    ipconfig
    

    You'll get a list containing lots of IP Addresses divided into categories. Look for a header with a Default tag.

    ipconfig output that you're looking for

    Now copy the IPv4 Address that's written there.

    Connect to the WSA using the following code:

    adb connect <Your IPv4 Address>:58526
    

    You'll get a prompt from WSA requesting you to allow debugging. Press Accept and you're done!

    Source: https://learn.microsoft.com/en-us/windows/android/wsa/