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, mtu, operator =, packetSize, receiveFrom, sendTo, timeout, ttl

Inherited Functions: address, available, close, destroyBufVec, error, fromFileDescriptor, getBlocking, getError, getKeepAlive, getLinger, getNoDelay, getOOBInline, getOption, getReceiveBufferSize, getReceiveTimeout, getReuseAddress, getReusePort, getSendBufferSize, getSendTimeout, impl, init, isDatagram, isNull, isRaw, isStream, lastError, lastErrorDesc, makeBufVec, makeBuffer, 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, type



    const Socket & socket

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


    SocketAddress::Family family,
    int dataSize = 48,
    int ttl = 128,
    int timeout = 5000000

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 ownership of the SocketImpl.

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


~ICMPSocket virtual


Destroys the ICMPSocket.

Member Functions


int dataSize() const;

Returns the data size in bytes.

mtu static

static Poco::UInt16 mtu(
    const SocketAddress & address,
    Poco::UInt16 sz

Returns minimum payload path MTU size for the destination, or 0 if MTU can not be determined.

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 packetSize() const;

Returns the packet size in bytes.


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.


int timeout() const;

Returns the socket timeout value.


int ttl() const;

Returns the Time-To-Live value.