Quantum 3 3.1.0

Public Member Functions | Static Public Member Functions | Public Attributes | Static Public Attributes | Properties | List of all members
Photon.Realtime.RegionPinger Class Reference

Wraps the ping attempts and workflow for a single region. More...

Public Member Functions

 RegionPinger (Region region, Action< Region > onDoneCallback)
 Initializes a RegionPinger for the given region. More...
 
string GetResults ()
 Gets this region's results as string summary. More...
 
bool Start ()
 Starts the ping routine for the assigned region. More...
 

Static Public Member Functions

static string ResolveHost (string hostName)
 Attempts to resolve a hostname into an IP string or returns empty string if that fails. More...
 

Public Attributes

int CurrentAttempt = 0
 Current ping attempt count. More...
 

Static Public Attributes

static int Attempts = 5
 How often to ping a region. More...
 
static int MaxMillisecondsPerPing = 800
 How long to wait maximum for a response. More...
 
static int PingWhenFailed = Attempts * MaxMillisecondsPerPing
 Ping result when pinging failed. More...
 

Properties

bool Aborted [get]
 Set to true to abort pining this region. More...
 
bool Done [get]
 True if all attempts are done or timed out. More...
 

Detailed Description

Wraps the ping attempts and workflow for a single region.

Constructor & Destructor Documentation

◆ RegionPinger()

Photon.Realtime.RegionPinger.RegionPinger ( Region  region,
Action< Region >  onDoneCallback 
)
inline

Initializes a RegionPinger for the given region.

Member Function Documentation

◆ Start()

bool Photon.Realtime.RegionPinger.Start ( )
inline

Starts the ping routine for the assigned region.

Pinging runs in a ThreadPool worker item or (if needed) in a Thread. WebGL runs pinging on the Main Thread as coroutine.

Returns
True unless Aborted.

◆ GetResults()

string Photon.Realtime.RegionPinger.GetResults ( )
inline

Gets this region's results as string summary.

◆ ResolveHost()

static string Photon.Realtime.RegionPinger.ResolveHost ( string  hostName)
inlinestatic

Attempts to resolve a hostname into an IP string or returns empty string if that fails.

To be compatible with most platforms, the address family is checked like this:
if (ipAddress.AddressFamily.ToString().Contains("6")) // ipv6...

Parameters
hostNameHostname to resolve.
Returns
IP string or empty string if resolution fails

Member Data Documentation

◆ Attempts

int Photon.Realtime.RegionPinger.Attempts = 5
static

How often to ping a region.

◆ MaxMillisecondsPerPing

int Photon.Realtime.RegionPinger.MaxMillisecondsPerPing = 800
static

How long to wait maximum for a response.

◆ PingWhenFailed

int Photon.Realtime.RegionPinger.PingWhenFailed = Attempts * MaxMillisecondsPerPing
static

Ping result when pinging failed.

◆ CurrentAttempt

int Photon.Realtime.RegionPinger.CurrentAttempt = 0

Current ping attempt count.

Property Documentation

◆ Done

bool Photon.Realtime.RegionPinger.Done
get

True if all attempts are done or timed out.

◆ Aborted

bool Photon.Realtime.RegionPinger.Aborted
get

Set to true to abort pining this region.