i got this error while running my function.
"socket.error: [Errno 98] Address already in use"
how can i close the address already in use and start new connection with port in python?
These scenarios will raise error "[Errno 98] Address already in use" when you create a socket at certain port:
The port was't closed. When you created a socket, but forgot to close it, or annother program hold that.
You have close the socket(or kill the process), but the port stay at TIME_WAIT status in 2 MSL(about 2 minutes).
Try "netstat" command to view port usage
such as
netstat -na
or
netstat -na |grep 54321