I'm learning how to use sockets in python, and quite often when my program crashes or I Ctrl+C the server socket somehow stays listening on the port. This obviously stops the program from listening on that port when it starts back up again, so I have to keep changing it.
I'm guessing I need to do socket.close() somewhere, but where?