Skip to content

Q: Is it possible to detect wether the server:port is available? #1

@vdevos

Description

@vdevos

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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions