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 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, 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
ICMPSocket(
const Socket & socket
);
Creates the ICMPSocket with the SocketImpl from another socket. The SocketImpl must be a DatagramSocketImpl, otherwise an InvalidArgumentException will be thrown.
ICMPSocket(
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(
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();
Destroys the ICMPSocket.
int dataSize() const;
Returns the data size in bytes.
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.
int timeout() const;
Returns the socket timeout value.
int ttl() const;
Returns the Time-To-Live value.