Hot Door CORE 0.8.2
Adobe® Illustrator® Plug-in Library
Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | List of all members
hdi::core::InternetPing Class Reference

Allows for the creation of simple ICMP ping clients to check the availability of a remote host. More...

#include <hdicoreInternetPing.h>

Public Member Functions

 InternetPing (const std::string &domain_, const Callback &success_, const Callback &failure_)
 Creates a synchronous (blocking) InternetPing object to perform a ping request.
 
virtual ~InternetPing ()
 Destructs an InternetPing object.
 
virtual bool asynchronous () const
 Gets whether the target object is asynchronous (i.e. executes in a background thread)
 
virtual void run ()
 Starts the ping request.
 
virtual bool running () const
 Gets whether the ping request is currently running.
 
virtual bool reached () const
 Gets whether the remote host was reached when pinged.
 
virtual double timing () const
 Gets how long it took to reach the remote host.
 
virtual std::string address () const
 Gets the IP address of the remote host for the domain given when the InternetPing object was constructed.
 
virtual std::string error () const
 Gets an error description if the ping request failed.
 

Static Public Member Functions

static InternetPingAsync (const std::string &domain_, const Callback &success_, const Callback &failure_)
 Creates an asynchronous (non-blocking) InternetPing object to perform a ICMP ping request.
 

Detailed Description

Allows for the creation of simple ICMP ping clients to check the availability of a remote host.

Note
All pings have a time-to-live of 60 seconds.

Constructor & Destructor Documentation

◆ InternetPing()

hdi::core::InternetPing::InternetPing ( const std::string &  domain_,
const Callback success_,
const Callback failure_ 
)

Creates a synchronous (blocking) InternetPing object to perform a ping request.

Author
GW
Date
03/2017
Parameters
domain_Domain name to ping, as UTF-8
success_Callback to perform when the request completes successfully
failure_Callback to perform when the request fails
Note
The callbacks will not be called if their scheduling comes during or after plugin pre-shutdown (this would lead to a crash on quit).

◆ ~InternetPing()

virtual hdi::core::InternetPing::~InternetPing ( )
virtual

Destructs an InternetPing object.

Author
GW
Date
03/2017

Member Function Documentation

◆ address()

virtual std::string hdi::core::InternetPing::address ( ) const
virtual

Gets the IP address of the remote host for the domain given when the InternetPing object was constructed.

Author
GW
Date
03/2017
Returns
The IPv4 or IPv6 address of the host (whichever was actually used for the ping), or "" if the host was not reached at all
Note
The results of this method are only valid when it is called from the "success" callback (see the InternetPing constructor).

◆ Async()

static InternetPing * hdi::core::InternetPing::Async ( const std::string &  domain_,
const Callback success_,
const Callback failure_ 
)
static

Creates an asynchronous (non-blocking) InternetPing object to perform a ICMP ping request.

Author
GW
Date
03/2017
Parameters
domain_Domain name to ping, as UTF-8
success_Callback to perform when the request completes successfully
failure_Callback to perform when the request fails
Warning
The responsibility for the memory of the returned InternetPing pointer lies with the caller, and it must not be deleted until after either the success or failure callbacks are called.
Note
Asynchronous InternetPing objects must be allocated using operator new and have several internal flags set (only synchronous InternetPing objects can be allocated on the stack), which this function does automatically.
The callbacks will not be called if their scheduling comes during or after plugin pre-shutdown (this would lead to a crash on quit).

◆ asynchronous()

virtual bool hdi::core::InternetPing::asynchronous ( ) const
virtual

Gets whether the target object is asynchronous (i.e. executes in a background thread)

Author
GW
Date
03/2017
Returns
true for asynchronous, false for synchronous

◆ error()

virtual std::string hdi::core::InternetPing::error ( ) const
virtual

Gets an error description if the ping request failed.

Author
GW
Date
03/2017
Returns
The resultant error of the request, as UTF-8
Note
The results of this method are only valid when it is called from the "failure" callback (see the InternetPing constructor).

◆ reached()

virtual bool hdi::core::InternetPing::reached ( ) const
virtual

Gets whether the remote host was reached when pinged.

Author
GW
Date
03/2017
Returns
true if the remote host was reached, false otherwise
Note
The results of this method are only valid when it is called from the "success" callback (see the InternetPing constructor).

◆ run()

virtual void hdi::core::InternetPing::run ( )
virtual

Starts the ping request.

Author
GW
Date
03/2017

◆ running()

virtual bool hdi::core::InternetPing::running ( ) const
virtual

Gets whether the ping request is currently running.

Author
GW
Date
03/2017
Returns
true if the request is running, false otherwise

◆ timing()

virtual double hdi::core::InternetPing::timing ( ) const
virtual

Gets how long it took to reach the remote host.

Author
GW
Date
03/2017
Returns
Total round-trip time, in seconds, to reach the host, or -1.0 if the host was not reached at all
Note
The results of this method are only valid when it is called from the "success" callback (see the InternetPing constructor).