2021年10月26日 星期二

scrcpy error: Could not listen on port

 

Symptoms 徵狀

scrcpy started but error happened even using -p :

使用 scrcpy 時出現無法開啟 port,即使指定特定的 port 時也一樣。

scrcpy --turn-screen-off --stay-awake -p 37183
INFO: scrcpy 1.15.1 <https://github.com/Genymobile/scrcpy>
D:\working\scrcpy-win64-v1.15.1\scrcpy-server: 1 file pushed, 0 skipped. 29.3 MB/s (33642 bytes in 0.001s)
bind: No error
ERROR: Could not listen on port 37183
WARN: 'adb reverse' failed, fallback to 'adb forward'
adb.exe: error: cannot bind listener: cannot bind to 127.0.0.1:37183: 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 port 37183
Press any key to continue...


Cause 原因

network or something broken.

網路服務或是不明的錯誤。


Resolution 解決方案

open command prompt then execute the commands below:

打開命令提示字元後輸入以下指令:

net stop hns.

type 'y' and enter

net start hns.


Reference參考

https://stackoverflow.com/questions/10461257/an-attempt-was-made-to-access-a-socket-in-a-way-forbidden-by-its-access-permissi