how to shutdown port in windows

C++
taskkill /F /PID PORT_NUMBER# Print PID of process bound on that port.
fuser 8080/tcp

# Kill that process
fuser -k 8080/tcpnetstat  -ano  |  findstr  < Port Number >
taskkill  /F  /PID  < Process Id >
Source

Also in C++: