This repository has been archived by the owner on Jun 8, 2024. It is now read-only.
forked from alanmcgovern/Mono.Nat
-
Notifications
You must be signed in to change notification settings - Fork 100
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.
Creates the port map asynchronous.
Name | Description |
---|---|
mapping: | The [[Mapping |
C# code |
device.CreatePortMapAsync(new Mapping(Protocol.Tcp, 1700, 1600));
MappingException: MappingException
Deletes a mapped port asynchronous.
Name | Description |
---|---|
mapping: | The [[Mapping |
C# code |
device.DeletePortMapAsync(new Mapping(Protocol.Tcp, 1700, 1600));
MappingException: MappingException-class
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
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
Gets the specified mapping asynchronous.
Name | Description |
---|---|
protocol: | The protocol. |
port: | The port. |
Returns: The matching mapping