Show / Hide Table of Contents

Class Client

Communicates with a NAT that speaks the Port Control Protocol.

Inheritance
Object
NatClient
Client
Inherited Members
NatClient.RequestPort
NatClient.InitialTimeout
NatClient.MaxRetries
NatClient.LocalEndPoint
NatClient.RemoteEndPoint
NatClient.UnavailableReason
NatClient.SendAndReceiveAsync(NatMessage)
NatClient.SendAndReceiveAsync(Byte[])
Object.ToString()
Object.Equals(Object)
Object.Equals(Object, Object)
Object.ReferenceEquals(Object, Object)
Object.GetHashCode()
Object.GetType()
Object.MemberwiseClone()
Namespace: Makaretu.Nat.Pcp
Assembly: Makaretu.Nat.dll
Syntax
public class Client : NatClient
Remarks

PCP allows applications to create mappings from an external IP address, protocol, and port to an internal IP address, protocol, and port. These mappings are required for successful inbound communications destined to machines located behind a NAT or a firewall.

Constructors

| Improve this Doc View Source

Client(IPAddress)

Creates a new instance of the Client class with the specified IP Address of the NAT.

Declaration
public Client(IPAddress address)
Parameters
Type Name Description
IPAddress address

The IP address of the NAT server.

Fields

| Improve this Doc View Source

ProtocolVersion

The version of the NAT-PCP.

Declaration
public const int ProtocolVersion = 2
Field Value
Type Description
Int32

Methods

| Improve this Doc View Source

CreatePublicEndpointAsync(ProtocolType, Int32)

Create an endpoint that can be connected to by devices outside of the NAT.

Declaration
public override Task<Lease> CreatePublicEndpointAsync(ProtocolType protocol, int port)
Parameters
Type Name Description
ProtocolType protocol

Either Tcp or Udp.

Int32 port

The intenral port of the server.

Returns
Type Description
Task<Lease>

A task that represents the asynchronous operation. The task's result is a Lease that defines an endpoint that is connectable by devices not behind the NAT.

Overrides
NatClient.CreatePublicEndpointAsync(ProtocolType, Int32)
| Improve this Doc View Source

DeletePublicEndpointAsync(Lease)

Cancel the lease.

Declaration
public override Task DeletePublicEndpointAsync(Lease lease)
Parameters
Type Name Description
Lease lease

The lease to break.

Returns
Type Description
Task

A task that represents the asynchronous operation.

Overrides
NatClient.DeletePublicEndpointAsync(Lease)
Remarks

Tells that NAT that the public endpoint can be removed.

| Improve this Doc View Source

IsAvailableAsync()

Determines if the NAT is online.

Declaration
public override Task<bool> IsAvailableAsync()
Returns
Type Description
Task<Boolean>

A task that represents the asynchronous operation. The task's result is true if the NAT is online and speaks the correct protocol; otherwise, false.

Overrides
NatClient.IsAvailableAsync()
| Improve this Doc View Source

RenewPublicEndpointAsync(Lease)

Renew the lease.

Declaration
public override Task<Lease> RenewPublicEndpointAsync(Lease lease)
Parameters
Type Name Description
Lease lease

The lease to renew.

Returns
Type Description
Task<Lease>

A task that represents the asynchronous operation. The task's result is a Lease that defines an endpoint that is connectable by devices not behind the NAT.

Overrides
NatClient.RenewPublicEndpointAsync(Lease)
Remarks

The returned Lease may have different external address and/or port than the original lease.

See Also

RFC 6887 - NAT Port Control Protocol
  • Improve this Doc
  • View Source
Back to top Generated by DocFX