Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I delete a UNIX Domain Socket file when I exit my application?

Tags:

People also ask

How do I remove Socketpath?

Abstract socket should be automatically removed by kernel when no processes use it, so to "remove" it you should close all server and client descriptors referring socket or just kill all server and client processes.

Are UNIX domain sockets reliable?

Valid socket types in the UNIX domain are: SOCK_STREAM, for a stream-oriented socket; SOCK_DGRAM, for a datagram-oriented socket that preserves message boundaries (as on most UNIX implementations, UNIX domain datagram sockets are always reliable and don't reorder datagrams); and (since Linux 2.6.


I have a server application that creates a UNIX Domain Socket in a specific path with a name and bind()s to it.

I need to delete the socket only when I close/stop the application intentionally, from within the the application code; otherwise it needs to be open. How do I do this?

Thanks!

Edit: Consider that I start and run my application from inside a terminal.