scrcpy: Numerous "could not listen..." errors after updating Android 11 device to Sept. 5 security patch
Environment
- OS: [Windows 10 21H1]
- scrcpy version: [1.18]
- installation method: [Windows binary, 64-bit]
- device model: Pixel 3a
- Android version: [11]
Describe the bug
Device (Android 11) was working fine with scrcpy prior to 9/5 security update. After security update, app fails to run. adb devices seems to show the device fine (only one connected), adb shell gets a device shell fine. Console output and adb logcat (flushed right before trying scrcpy) given below.
console output (some repetitive lines skipped):
D:\Programs\scrcpy-win64\scrcpy-server: 1 file pushed, 0 skipped. 30.3 MB/s (37330 bytes in 0.001s)
bind: No error
WARN: Could not listen on port 27183, retrying on 27184
bind: No error
WARN: Could not listen on port 27184, retrying on 27185
bind: No error
...
WARN: Could not listen on port 27198, retrying on 27199
bind: No error
ERROR: Could not listen on any port in range 27183:27199
WARN: 'adb reverse' failed, fallback to 'adb forward'
adb.exe: error: cannot bind listener: cannot bind to 127.0.0.1:27183: An attempt was made to access a socket in a way forbidden by its access permissions. (10013)
ERROR: "adb forward" returned with value 1
WARN: Could not forward port 27183, retrying on 27184
adb.exe: error: cannot bind listener: cannot bind to 127.0.0.1:27184: An attempt was made to access a socket in a way forbidden by its access permissions. (10013)
ERROR: "adb forward" returned with value 1
WARN: Could not forward port 27184, retrying on 27185
...
WARN: Could not forward port 27198, retrying on 27199
adb.exe: error: cannot bind listener: cannot bind to 127.0.0.1:27199: An attempt was made to access a socket in a way forbidden by its access permissions. (10013)
ERROR: "adb forward" returned with value 1
ERROR: Could not forward any port in range 27183:27199
logcat (don’t think it’s relevant, not sure):
--------- beginning of system
09-09 07:48:40.741 1403 1788 I chatty : uid=1000(system) ConnectivitySer expire 18 lines
--------- beginning of main
09-09 07:48:42.694 2789 2813 I chatty : uid=10140(com.google.android.apps.scone) StateService expire 2 lines
09-09 07:48:42.698 2789 2813 D DeviceStateHelper: Audo mode: 0
09-09 07:48:43.774 1403 1788 D ConnectivityService: NetReassign [no changes]
09-09 07:48:43.987 7231 8862 D [TORNET]: [TORNET][NOTE ] Sending Heartbeat to Server
09-09 07:48:44.188 7231 8862 D [TORNET]: [TORNET][DEBUG] Received HeartBeat from Server
09-09 07:48:44.962 905 905 I android.hardware.health@2.0-service.bonito: capacity: 3606000
09-09 07:48:44.981 1878 2993 D PowerUI : can't show warning due to - plugged: true status unknown: false
09-09 07:48:46.805 1403 1788 D ConnectivityService: NetReassign [no changes]
09-09 07:48:47.724 2789 2813 D DeviceStateHelper: Audo mode: 0
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Comments: 20
Commits related to this issue
- Retrieve correct error messages on Windows For sockets functions, Windows does not store error codes in errno, so perror() does not print any error. Use WSAGetLastError() instead. Refs #2624 <https:... — committed to Genymobile/scrcpy by rom1v 3 years ago
- Retrieve correct error messages on Windows For sockets functions, Windows does not store error codes in errno, so perror() does not print any error. Use WSAGetLastError() instead. Refs #2624 <https:... — committed to Genymobile/scrcpy by rom1v 3 years ago
Didn’t get a chance to test the second idea, because the first one (the one I got from reading the link) worked. After disconnecting the device, I went to Device Manager, selected the “show hidden devices” option in the View menu, found the device’s old entry in the Portable Devices category and uninstalled it. (Had I found multiples, I would’ve uninstalled them all, but I only found one.) Rebooted, tried again and scrcpy worked just fine. Hopefully that helps the next person that runs into the problem!