com.onlineobject.objectnet Namespace

NatDiscoverer..::..DiscoverDeviceAsync Method (PortMapper, CancellationTokenSource)

Discovers and returns a NAT device for the specified type; otherwise a NatDeviceNotFoundException exception is thrown when it is cancelled.

Namespace:  com.onlineobject.objectnet
Assembly:  ObjectNetAPI (in ObjectNetAPI.dll)

Syntax


public Task<NatDevice> DiscoverDeviceAsync(

	PortMapper portMapper,

	CancellationTokenSource cancellationTokenSource

)

Parameters

portMapper
Type: com.onlineobject.objectnet..::..PortMapper
Port mapper protocol; Upnp, Pmp or both
cancellationTokenSource
Type: CancellationTokenSource
Cancellation token source for cancelling the discovery process

Return Value

A NAT device

Exceptions


ExceptionCondition
com.onlineobject.objectnet..::..NatDeviceNotFoundExceptionwhen no NAT found before cancellation

Remarks


It allows to specify the NAT type to discover as well as the cancellation token in order.