C# Class Open.Nat.NatDiscoverer

Afficher le fichier Open project: mcatanzariti/Open.NAT Class Usage Examples

Méthodes publiques

Свойство Type Description
TraceSource System.Diagnostics.TraceSource

Méthodes publiques

Méthode Description
DiscoverDeviceAsync ( ) : Task

Discovers and returns an UPnp or Pmp NAT device; otherwise a NatDeviceNotFoundException exception is thrown after 3 seconds.

DiscoverDeviceAsync ( PortMapper portMapper, CancellationTokenSource cancellationTokenSource ) : Task

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

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

DiscoverDevicesAsync ( PortMapper portMapper, CancellationTokenSource cancellationTokenSource ) : Task>

Discovers and returns all NAT devices for the specified type. If no NAT device is found it returns an empty enumerable

ReleaseAll ( ) : void

Release all ports opened by Open.NAT.

If ReleaseOnShutdown value is true, it release all the mappings created through the library.

Private Methods

Méthode Description
DiscoverAsync ( PortMapper portMapper, bool onlyOne, CancellationTokenSource cts ) : Task>
ReleaseSessionMappings ( ) : void
RenewMappings ( object state ) : void

Method Details

DiscoverDeviceAsync() public méthode

Discovers and returns an UPnp or Pmp NAT device; otherwise a NatDeviceNotFoundException exception is thrown after 3 seconds.
when no NAT found before 3 seconds.
public DiscoverDeviceAsync ( ) : Task
Résultat Task

DiscoverDeviceAsync() public méthode

Discovers and returns a NAT device for the specified type; otherwise a NatDeviceNotFoundException exception is thrown when it is cancelled.
It allows to specify the NAT type to discover as well as the cancellation token in order.
when no NAT found before cancellation
public DiscoverDeviceAsync ( PortMapper portMapper, CancellationTokenSource cancellationTokenSource ) : Task
portMapper PortMapper Port mapper protocol; Upnp, Pmp or both
cancellationTokenSource System.Threading.CancellationTokenSource Cancellation token source for cancelling the discovery process
Résultat Task

DiscoverDevicesAsync() public méthode

Discovers and returns all NAT devices for the specified type. If no NAT device is found it returns an empty enumerable
public DiscoverDevicesAsync ( PortMapper portMapper, CancellationTokenSource cancellationTokenSource ) : Task>
portMapper PortMapper Port mapper protocol; Upnp, Pmp or both
cancellationTokenSource System.Threading.CancellationTokenSource Cancellation token source for cancelling the discovery process
Résultat Task>

ReleaseAll() public static méthode

Release all ports opened by Open.NAT.
If ReleaseOnShutdown value is true, it release all the mappings created through the library.
public static ReleaseAll ( ) : void
Résultat void

Property Details

TraceSource public_oe static_oe property

The TraceSource instance used for debugging and Troubleshooting
At least one trace listener has to be added to the Listeners collection if a trace is required; if no listener is added there will no be tracing to analyse. Open.NAT only supports SourceLevels.Verbose, SourceLevels.Error, SourceLevels.Warning and SourceLevels.Information.
public static TraceSource,System.Diagnostics TraceSource
Résultat System.Diagnostics.TraceSource