I have a problem with terminating a process created by socket in python.
So I wanted to create a UDP server in python, so I did socket.bind() to bind IP address and port to the server, I got some error in program and then again...I tried to use socket.bind() again, but it says it is already in use.
After a while I found out in Resource Monitor that I have this "connection" there.
My .py file:
serverIP = input()
serverPort = int(input())
server_socket = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
try:
server_socket.bind((serverIP, serverPort))
except OSError:
print("Already in use")
return
I cannot terminate in control panel that process because it says: Access denied.
I cannot terminate it through cmd with admin rights.
Reboot does not help.
Any ideas how to close it?
CodePudding user response:
Try to identify the PID of the process (with the task manager or the tasklist
command
Then kill the task using powershell with taskkill /PID <PID_HERE>
EDIT : Apparently port 137 is used by NetBIOS Name Service, so check with the Windows firewall