Search code examples
androidtcpcmdport

close a port in cmd


I need to use port 5037 under windows for adb (android).

When I type:

G:\AndroidSDK\platform-tools>adb nodaemon server

It gives:

cannot bind 'tcp:5037'

This means that port 5037 is currently occupied...

When I type:

C:\WINDOWS\System32>netstat -ano | findstr "5037"

It gives:

TCP    127.0.0.1:5037         0.0.0.0:0              LISTENING       16836
TCP    127.0.0.1:5037         127.0.0.1:52818        TIME_WAIT       0
TCP    127.0.0.1:5037         127.0.0.1:52819        TIME_WAIT       0
TCP    127.0.0.1:5037         127.0.0.1:52820        TIME_WAIT       0
TCP    127.0.0.1:5037         127.0.0.1:52821        TIME_WAIT       0
TCP    127.0.0.1:5037         127.0.0.1:52823        TIME_WAIT       0
TCP    127.0.0.1:5037         127.0.0.1:52824        TIME_WAIT       0
....(a lot of such)
TCP    127.0.0.1:53097        127.0.0.1:5037         TIME_WAIT       0
TCP    127.0.0.1:53110        127.0.0.1:5037         TIME_WAIT       0
TCP    127.0.0.1:53111        127.0.0.1:5037         TIME_WAIT       0
TCP    127.0.0.1:53118        127.0.0.1:5037         TIME_WAIT       0
....(a lot of such)

What should I do to clear port 5037?


Solution

  • Type "tasklist" in cmd console to find which process occupy port 5037, then go to task manager to kill such process.