I'm trying to monitor a unix socket ("/tmp/mysocket").
I can do this fine in Node.js: it raises an event when
- a socket is bound
- someone connects to the socket
- data is sent to the socket and
- the socket is disconnected.
I'm trying to now do this in C/C++: I want to monitor "/tmp/mysocket" for the above events. I've looked at libevent (which I'd preferably like to use), but see that it requires an IP:port. Is there any way to monitor unix sockets?
Or can anyone suggest another C/C++ solution?
You could monitor a UNIX domain socket just like a regular file, since it can be operated like a file, e.g. in libev,
libevent should be similar.