class Poco::Net::ICMPClient

Overview

This class provides ICMP Ping functionality. More…

#include <ICMPClient.h>

class ICMPClient
{
public:
    // fields

    Poco::BasicEvent<ICMPEventArgs> pingBegin;
    Poco::BasicEvent<ICMPEventArgs> pingReply;
    Poco::BasicEvent<ICMPEventArgs> pingError;
    Poco::BasicEvent<ICMPEventArgs> pingEnd;

    // construction

    ICMPClient(IPAddress::Family family);

    // methods

    int
    ping(
        SocketAddress& address,
        int repeat = 1
        ) const;

    int
    ping(
        const std::string& address,
        int repeat = 1
        ) const;

    static
    int
    ping(
        SocketAddress& address,
        IPAddress::Family family,
        int repeat = 1
        );

    static
    int
    pingIPv4(
        const std::string& address,
        int repeat = 1
        );
};

Detailed Documentation

This class provides ICMP Ping functionality.

The events are available when class is instantiated and non-static member functions are called.

A “lightweight” alternative is direct (without instantiation) use of static member functions.

Construction

ICMPClient(IPAddress::Family family)

Creates an ICMP client.

Methods

int
ping(
    SocketAddress& address,
    int repeat = 1
    ) const

Pings the specified address [repeat] times.

Notifications are posted for events.

Returns the number of valid replies.

int
ping(
    const std::string& address,
    int repeat = 1
    ) const

Calls ICMPClient::ping(SocketAddress&, int) and returns the result.

Returns the number of valid replies.

static
int
ping(
    SocketAddress& address,
    IPAddress::Family family,
    int repeat = 1
    )

Pings the specified address [repeat] times.

Notifications are not posted for events.

Returns the number of valid replies.

static
int
pingIPv4(
    const std::string& address,
    int repeat = 1
    )

Calls ICMPClient::ping(SocketAddress&, int) and returns the result.

Returns the number of valid replies.