Version 1/3 - Next » - Current version
Alan McGovern, 04/16/2009 10:06 PM


API Reference class NatTest {
public static void Main(string[] args) {
new NatTest ();
} [/pre]

public NatTest ()
    {
NatUtility.DeviceFound += DeviceFound;
NatUtility.DeviceLost += DeviceLost; }
NatUtility.StartDiscovery ();
Console.ReadLine();
}
private void DeviceFound(object sender, DeviceEventArgs args)
{
INatDevice device = args.Device; }
// Create a mapping to forward external port 3000 to local port 1500
device.CreatePortMap(new Mapping(Protocol.Tcp, 1500, 3000));
// Retrieve the details for the port map for external port 3000
Mapping m = device.GetSpecificMapping(Protocol.Tcp, 3000);
// Get all the port mappings on the device and delete them
foreach (Mapping mp in device.GetAllMappings())
device.DeletePortMap(mp);
// Get the external IP address
IPAddress externalIP = device.GetExternalIP();
private void DeviceLost (object sender, DeviceEventArgs args)
{
INatDevice device = args.Device; }
Console.WriteLine ("Device Lost");
Console.WriteLine ("Type: {0}", device.GetType().Name);

Also available in: HTML TXT