# Poco::Net

# class ICMPClient

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(
IPAddress::Family family
);

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 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.

### pingIPv4

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.

## 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;