Symptom
An error message "hdc server port XXXX has been used" is displayed during hdc device debugging, and the error persists after the port is manually switched.
Possible Causes
Solution
Query the port.
$ netstat -ano | findstr :{Port number}
End the service.
$ taskkill /PID {PID} /F
Note: Replace the port number and PID with the actual ones. Query the port.
$ lsof -i :{Port number}
$ netstat -tuln | grep :{Port number}
End the service.
$ kill -9 {PID}
Note: Replace the port number and PID with the actual ones. View the dynamic port range.
$ netsh int ipv4 show dynamicport tcp
View the exception port range.
$ taskkill /PID {PID} /F
Note: Replace the port number and PID with the actual ones. If the query result shows that the occupied port is an exception port, perform the following steps or manually restart the Hyper-V service in the task manager:
Disable Hyper-V [Required to restart the computer] $ dism.exe /Online /Disable-Feature:Microsoft-Hyper-V Enable Hyper-V [Required to restart the computer] $ dism.exe /Online /Enable-Feature:Microsoft-Hyper-V /All