I'm using statsd-c-client in a C++ project of mine and I've been trying to add some functionality in order to detect if statsd is listening from server-ip on port. But since the socket is setup with SOCK_DGRAM and IPPROTO_UDP it's simply not possible to detect whether the service is at all listening/receiving (no sendto failures)
I've also tried to setup a temporary socket type SOCK_STREAM and added a signal(SIGPIPE, sigpipe_handler) as a sig-handler. Then normally, when you would write (and no service was listening) you would get a pipe error which could serve as a indicator that statsd is not active as a service. The problem is that statsd is not supporting these kind of socket connections (which I can understand) but making it almost impossible to solve..
You think there might be a other way to detect this?
I'm using
statsd-c-clientin a C++ project of mine and I've been trying to add some functionality in order to detect if statsd is listening fromserver-iponport. But since the socket is setup withSOCK_DGRAMandIPPROTO_UDPit's simply not possible to detect whether the service is at all listening/receiving (nosendtofailures)I've also tried to setup a temporary
sockettypeSOCK_STREAMand added asignal(SIGPIPE, sigpipe_handler)as a sig-handler. Then normally, when you would write (and no service was listening) you would get a pipe error which could serve as a indicator that statsd is not active as a service. The problem is that statsd is not supporting these kind of socket connections (which I can understand) but making it almost impossible to solve..You think there might be a other way to detect this?