Either by fixing the application so that it deletes (disconnects) the socket file on exit, or if you know the location of the socket file:
fuser sockfile.sock || rm sockfile.sock
This checks if the process uses the file and if it does rm if it does not. You can put this in a shell script that actually executes the application and subsequently flushes the socket file.
Friek source share