Signature |
hs.network.host.reachabilityForAddress(address[, fn]) -> integer | hostObject |
Type |
Function |
Description |
Get the reachability status for the IP address specified. |
Parameters |
- address - a string or number representing an IPv4 or IPv6 network address to check the reachability for. If the argument is a number, it is treated as the 32 bit numerical representation of an IPv4 address.
- fn - an optional callback function which, when provided, will determine the address reachability in an asynchronous, non-blocking manner.
|
Returns |
- If this function is called without a callback function, returns the numeric representation of the address reachability status. If a callback function is specified, then a host object is returned.
|
Notes |
- If no callback function is provided, the resolution occurs in a blocking manner which may be noticeable when network access is slow or erratic.
- If a callback function is provided, this function acts as a constructor, returning a host object and the callback function will be invoked when resolution is complete. The callback function should take two parameters: the string "reachability", indicating that reachability was determined, and the numeric representation of the address reachability status.
- Generates an error if network access is currently disabled or the IP address is invalid.
- The numeric representation is made up from a combination of the flags defined in
hs.network.reachability.flags .
- Performs the same reachability test as
hs.network.reachability.forAddress .
|
Source |
extensions/network/hostinternal.m |