SCNetworkCheckReachabilityByName

Function SCNetworkCheckReachabilityByName 

Source
pub unsafe extern "C-unwind" fn SCNetworkCheckReachabilityByName(
    nodename: NonNull<c_char>,
    flags: NonNull<SCNetworkConnectionFlags>,
) -> bool
๐Ÿ‘ŽDeprecated: No longer supported
Available on crate feature SCNetwork only.
Expand description

Determines if the given network host or node name is reachable using the current network configuration.

Note: this API has been deprecated but you can get equivalent results with :

SCNetworkReachabilityRef   target;
SCNetworkReachabilityFlags flags = 0;
Boolean                   ok;

target = SCNetworkReachabilityCreateWithName(NULL, name);
ok = SCNetworkReachabilityGetFlags(target,
&flags
);
CFRelease(target);

Parameter nodename: The node name of the desired host. This name would be the same as that passed to the gethostbyname(3) or getaddrinfo(3) functions.

Parameter flags: A pointer to memory that will be filled with a set of SCNetworkConnectionFlags detailing the reachability of the specified node name.

Returns: Returns TRUE if the network connection flags are valid; FALSE if the status could not be determined.

ยงSafety

  • nodename must be a valid pointer.
  • flags must be a valid pointer.