OiO.lk Blog python ADB Connection Issue with Droidbot on WSL: “Cannot bind to 127.0.0.1:60997: Only one usage of each socket address is normally permitted.”
python

ADB Connection Issue with Droidbot on WSL: “Cannot bind to 127.0.0.1:60997: Only one usage of each socket address is normally permitted.”


I’m trying to run Droidbot on WSL (Windows Subsystem for Linux) and connect to the ADB (Android Debug Bridge) server that I’m starting in PowerShell. While I can run and connect to ADB normally in PowerShell without any issues, I encounter the following error when I attempt to connect from WSL:

adb: error: cannot bind listener: cannot bind to 127.0.0.1:60997: Only one usage of each socket address (protocol/network address/port) is normally permitted. (10048)

Here’s the traceback I received:

Traceback (most recent call last):
  File "/home/mudoker/Projects/Automated-Test-Oracle/droidbot/droidbot/droidbot.py", line 177, in start
    self.device.connect()
  File "/home/mudoker/Projects/Automated-Test-Oracle/droidbot/droidbot/device.py", line 179, in connect
    adapter.connect()
  File "/home/mudoker/Projects/Automated-Test-Oracle/droidbot/droidbot/adapter/droidbot_app.py", line 107, in connect
    subprocess.check_call(forward_cmd.split())
  File "/usr/lib/python3.10/subprocess.py", line 369, in check_call
    raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['adb', '-s', 'emulator-5554', 'forward', 'tcp:60997', 'tcp:7336']' returned non-zero exit status 1.
[CONNECTION] ADB is disconnected
WARNING:DroidBotIme:Failed to disconnect DroidBotIME!
Please wait while uninstalling the app...

Context:

I start the ADB server in PowerShell and then try to run Droidbot in WSL.

I confirmed that no other process is using the port 60997.

I have restarted the ADB server multiple times.

What I’ve Tried:

Running adb kill-server and then adb start-server in both environments.

Checking for processes using port 60997 with sudo lsof -i :60997.

Attempting to use different ports in the ADB commands.

Question:

How can I resolve the port binding issue when trying to run Droidbot on WSL and connect to the ADB server running in PowerShell? Are there any specific configurations or commands I should use to facilitate this connection?

Any help would be greatly appreciated!



You need to sign in to view this answers

Exit mobile version