My partner and I currently have a Python app that opens A TCP socket that communicates with another Python app on a separate host. Every once in a while, we notice the program either errors or we kill it. When that happens, the socket is still open for some time. Every time after we go to run the program, we get the following error:
socket.error: [Errno 98] Address already in use
Our program is using the same port, which means the socket is still open. But we checked and we're pretty sure it's not running in the background and our address is still in use.
Is there a way we can manually close the socket to we can reuse it?