Skip to content
This repository has been archived by the owner on Jun 8, 2024. It is now read-only.

NatDevice 1.1

lontivero edited this page Apr 29, 2015 · 1 revision

Represents a NAT device and provides access to the operation set that allows open (forward) ports, close ports and get the externa (visible) IP address.


CreatePortMapAsync(Open.Nat.Mapping)

Creates the port map asynchronous.

Name Description
mapping: The [[Mapping
C# code
    device.CreatePortMapAsync(new Mapping(Protocol.Tcp, 1700, 1600));
    

MappingException: MappingException


DeletePortMapAsync(Open.Nat.Mapping)

Deletes a mapped port asynchronous.

Name Description
mapping: The [[Mapping
C# code
    device.DeletePortMapAsync(new Mapping(Protocol.Tcp, 1700, 1600));
    

MappingException: MappingException-class


GetAllMappingsAsync

Gets all mappings asynchronous.

Returns: The list of all forwarded ports

C# code

    var mappings = await device.GetAllMappingsAsync();
    foreach(var mapping in mappings)
    {
        Console.WriteLine(mapping)
    }
    

MappingException: MappingException


GetExternalIPAsync

Gets the external (visible) IP address asynchronous. This is the NAT device IP address

Returns: The public IP addrees

C# code

    Console.WriteLine("My public IP is: {0}", await device.GetExternalIPAsync());
    

MappingException: MappingException


GetSpecificMappingAsync(Open.Nat.Protocol,System.Int32)

Gets the specified mapping asynchronous.

Name Description
protocol: The protocol.
port: The port.

Returns: The matching mapping