C# 클래스 Open.Nat.NatDiscoverer

파일 보기 프로젝트 열기: mcatanzariti/Open.NAT 1 사용 예제들

공개 프로퍼티들

프로퍼티 타입 설명
TraceSource System.Diagnostics.TraceSource

공개 메소드들

메소드 설명
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.

비공개 메소드들

메소드 설명
DiscoverAsync ( PortMapper portMapper, bool onlyOne, CancellationTokenSource cts ) : Task>
ReleaseSessionMappings ( ) : void
RenewMappings ( object state ) : void

메소드 상세

DiscoverDeviceAsync() 공개 메소드

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
리턴 Task

DiscoverDeviceAsync() 공개 메소드

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
리턴 Task

DiscoverDevicesAsync() 공개 메소드

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
리턴 Task>

ReleaseAll() 공개 정적인 메소드

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
리턴 void

프로퍼티 상세

TraceSource 공개적으로 정적으로 프로퍼티

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
리턴 System.Diagnostics.TraceSource