Poco::Net

class ICMPClient

File Information

Library: Net
Package: ICMP
Header: Poco/Net/ICMPClient.h

Description

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.

Member Summary

Member Functions: ping, pingIPv4

Constructors

ICMPClient

explicit ICMPClient(
    SocketAddress::Family family,
    int dataSize = 48,
    int ttl = 128,
    int timeout = 50000
);

Creates an ICMP client.

Destructor

~ICMPClient

~ICMPClient();

Destroys the ICMP client.

Member Functions

ping

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.

ping

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.

ping static

static int ping(
    SocketAddress & address,
    SocketAddress::Family family,
    int repeat = 1,
    int dataSize = 48,
    int ttl = 128,
    int timeout = 100000
);

Pings the specified address [repeat] times. Notifications are not posted for events.

Returns the number of valid replies.

pingIPv4 static

static int pingIPv4(
    const std::string & address,
    int repeat = 1,
    int dataSize = 48,
    int ttl = 128,
    int timeout = 100000
);

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

Returns the number of valid replies.

Variables

pingBegin

mutable Poco::BasicEvent < ICMPEventArgs > pingBegin;

pingEnd

mutable Poco::BasicEvent < ICMPEventArgs > pingEnd;

pingError

mutable Poco::BasicEvent < ICMPEventArgs > pingError;

pingReply

mutable Poco::BasicEvent < ICMPEventArgs > pingReply;

Securely control IoT edge devices from anywhere   Connect a Device