• Api Documentation
  • Source Code
Search Results for

    Show / Hide Table of Contents
    • SharpOpenNat
      • Extensions
      • INatDevice
      • INatDiscoverer
      • Mapping
      • MappingException
      • MappingLifetime
      • NatDeviceNotFoundException
      • OpenNat
      • PortMapper
      • Protocol

    Interface INatDiscoverer

    Discovers NAT device;

    Inherited Members
    IDisposable.Dispose()
    Namespace: SharpOpenNat
    Assembly: SharpOpenNat.dll
    Syntax
    public interface INatDiscoverer : IDisposable

    Methods

    | Edit this page View Source

    DiscoverDeviceAsync(PortMapper, CancellationToken)

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

    Declaration
    Task<INatDevice> DiscoverDeviceAsync(PortMapper portMapper, CancellationToken cancellationToken = default)
    Parameters
    Type Name Description
    PortMapper portMapper

    Port mapper protocol; Upnp, Pmp or both

    CancellationToken cancellationToken

    Cancellation token for cancelling the discovery process

    Returns
    Type Description
    Task<INatDevice>

    A NAT device

    Remarks

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

    Exceptions
    Type Condition
    NatDeviceNotFoundException

    when no NAT found before cancellation

    | Edit this page View Source

    DiscoverDeviceAsync(CancellationToken)

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

    Declaration
    Task<INatDevice> DiscoverDeviceAsync(CancellationToken cancellationToken = default)
    Parameters
    Type Name Description
    CancellationToken cancellationToken
    Returns
    Type Description
    Task<INatDevice>

    A NAT device

    Exceptions
    Type Condition
    NatDeviceNotFoundException

    when no NAT found before 3 seconds.

    | Edit this page View Source

    DiscoverDevicesAsync(PortMapper, CancellationToken)

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

    Declaration
    Task<IEnumerable<INatDevice>> DiscoverDevicesAsync(PortMapper portMapper, CancellationToken cancellationToken = default)
    Parameters
    Type Name Description
    PortMapper portMapper

    Port mapper protocol; Upnp, Pmp or both

    CancellationToken cancellationToken

    Cancellation token for cancelling the discovery process

    Returns
    Type Description
    Task<IEnumerable<INatDevice>>

    All found NAT devices

    Extension Methods

    Extensions.GetAvailablePortAsync(INatDiscoverer, int, CancellationToken)
    Extensions.GetUsedPortsAsync(INatDiscoverer, CancellationToken)
    • Edit this page
    • View Source
    In this article
    Back to top Copyright Alan McGovern, Ben Motmans, Lucas Ontivero, Jérémy Ansel (c) 2006-2024