class Poco::Net::ICMPSocket
Overview
This class provides an interface to an ICMP client socket. More…
#include <ICMPSocket.h> class ICMPSocket: public Poco::Net::Socket { public: // construction ICMPSocket( IPAddress::Family family, int dataSize = 48, int ttl = 128, int timeout = 500000 ); ICMPSocket(const Socket& socket); // methods ICMPSocket& operator=(const Socket& socket); int sendTo( const SocketAddress& address, int flags = 0 ); int receiveFrom( SocketAddress& address, int flags = 0 ); int dataSize() const; int ttl() const; int timeout() const; protected: // construction ICMPSocket(SocketImpl* pImpl); };
Inherited Members
public: // typedefs typedef std::vector<Socket> SocketList; // enums enum SelectMode; // methods Socket& operator=(const Socket& socket); bool operator==(const Socket& socket) const; bool operator!=(const Socket& socket) const; bool operator<(const Socket& socket) const; bool operator<=(const Socket& socket) const; bool operator>(const Socket& socket) const; bool operator>=(const Socket& socket) const; void close(); bool poll( const Poco::Timespan& timeout, int mode ) const; int available() const; void setSendBufferSize(int size); int getSendBufferSize() const; void setReceiveBufferSize(int size); int getReceiveBufferSize() const; void setSendTimeout(const Poco::Timespan& timeout); Poco::Timespan getSendTimeout() const; void setReceiveTimeout(const Poco::Timespan& timeout); Poco::Timespan getReceiveTimeout() const; void setOption( int level, int option, int value ); void setOption( int level, int option, unsigned value ); void setOption( int level, int option, unsigned char value ); void setOption( int level, int option, const Poco::Timespan& value ); void setOption( int level, int option, const IPAddress& value ); void getOption( int level, int option, int& value ) const; void getOption( int level, int option, unsigned& value ) const; void getOption( int level, int option, unsigned char& value ) const; void getOption( int level, int option, Poco::Timespan& value ) const; void getOption( int level, int option, IPAddress& value ) const; void setLinger( bool on, int seconds ); void getLinger( bool& on, int& seconds ) const; void setNoDelay(bool flag); bool getNoDelay() const; void setKeepAlive(bool flag); bool getKeepAlive() const; void setReuseAddress(bool flag); bool getReuseAddress() const; void setReusePort(bool flag); bool getReusePort() const; void setOOBInline(bool flag); bool getOOBInline() const; void setBlocking(bool flag); bool getBlocking() const; SocketAddress address() const; SocketAddress peerAddress() const; SocketImpl* impl() const; bool secure() const; void init(int af); static int select( SocketList& readList, SocketList& writeList, SocketList& exceptList, const Poco::Timespan& timeout ); static bool supportsIPv4(); static bool supportsIPv6(); protected: // methods poco_socket_t sockfd() const;
Detailed Documentation
This class provides an interface to an ICMP client socket.
Construction
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(const Socket& socket)
Creates the ICMPSocket with the SocketImpl from another socket.
The SocketImpl must be a ICMPSocketImpl, otherwise an InvalidArgumentException will be thrown.
ICMPSocket(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.
Methods
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 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 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 dataSize() const
Returns the data size in bytes.
int ttl() const
Returns the Time-To-Live value.
int timeout() const
Returns the socket timeout value.