Skip to content

IDeviceNetwork

Interface in Oadm.Sdk.Sites · Oadm.Sdk.dll

Network checks towards one device, routed like the device: through its site, or on the server’s own network (ITaskExecutionContext.Network, ITaskQueryContext.Network). Never open sockets to devices yourself. Through a site that cannot carry a call (offline, a site node too old) a call throws an exception whose message says why (“Site offline: Building B”).

public interface IDeviceNetwork
Guid? SiteId { get; }

The site of this route; null = the server’s own network.

Task<IPAddress?> LocalAddressTowardsAsync(string address, CancellationToken ct)

The address OADM has towards address on this route: the server’s own, or the site node’s in the site network (what a device uses to reach OADM’s services, e.g. “Use OADM as NTP server”). Null when none.

Task<bool> PingAsync(string address, TimeSpan timeout, CancellationToken ct)

True when address answers a ping within timeout.

Task<bool> ProbeTcpAsync(string address, int port, TimeSpan timeout, CancellationToken ct)

True when a host answers on TCP port at address within timeout: it accepts the connection or actively refuses it (a refusal also proves the address is taken). The address-in-use check relies on it; the connection is closed at once.

bool Reaches(IPAddress address)

Default implementation

True when address is on a network this route reaches: always on the server’s own network; at a site only the networks the site node reaches (its chosen network cards and extra networks). A device at a site cannot move to an address outside them.

Task<IReadOnlyList<IPAddress>> ResolveAsync(string name, CancellationToken ct)

The addresses of a host name as this route resolves it; empty when unknown.