class ICMPSocket

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


This class provides an interface to an ICMP client socket.


Direct Base Classes: Socket

All Base Classes: Socket

Member Summary

Member Functions: dataSize, operator =, receiveFrom, sendTo, timeout, ttl

Inherited Functions: address, available, close, getBlocking, getKeepAlive, getLinger, getNoDelay, getOOBInline, getOption, getReceiveBufferSize, getReceiveTimeout, getReuseAddress, getReusePort, getSendBufferSize, getSendTimeout, impl, init, operator !=, operator <, operator <=, operator =, operator ==, operator >, operator >=, peerAddress, poll, secure, select, setBlocking, setKeepAlive, setLinger, setNoDelay, setOOBInline, setOption, setReceiveBufferSize, setReceiveTimeout, setReuseAddress, setReusePort, setSendBufferSize, setSendTimeout, sockfd, supportsIPv4, supportsIPv6



    const Socket & socket

Creates the ICMPSocket with the SocketImpl from another socket. The SocketImpl must be a DatagramSocketImpl, otherwise an InvalidArgumentException will be thrown.


    IPAddress::Family family,
    int dataSize = 48,
    int ttl = 128,
    int timeout = 500000

Creates an unconnected ICMP socket.

The socket will be created for the given address family.

ICMPSocket protected

    SocketImpl * pImpl

Creates the Socket and attaches the given SocketImpl. The socket takes owership of the SocketImpl.

The SocketImpl must be a ICMPSocketImpl, otherwise an InvalidArgumentException will be thrown.


~ICMPSocket virtual


Destroys the ICMPSocket.

Member Functions

dataSize inline

int dataSize() const;

Returns the data size in bytes.

operator =

ICMPSocket & operator = (
    const Socket & socket

Assignment operator.

Releases the socket's SocketImpl and attaches the SocketImpl from the other socket and increments the reference count of the SocketImpl.


int receiveFrom(
    SocketAddress & address,
    int flags = 0

Receives data from the socket. Stores the address of the sender in address.

Returns the time elapsed since the originating request was sent.


int sendTo(
    const SocketAddress & address,
    int flags = 0

Sends an ICMP request through the socket to the given address.

Returns the number of bytes sent.

timeout inline

int timeout() const;

Returns the socket timeout value.

ttl inline

int ttl() const;

Returns the Time-To-Live value.