Class Client
Communicates with a NAT that speaks the Port Control Protocol.
Inherited Members
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 SourceClient(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 SourceProtocolVersion
The version of the NAT-PCP.
Declaration
public const int ProtocolVersion = 2
Field Value
Type | Description |
---|---|
Int32 |
Methods
| Improve this Doc View SourceCreatePublicEndpointAsync(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 | |
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
| Improve this Doc View SourceDeletePublicEndpointAsync(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
Remarks
Tells that NAT that the public endpoint can be removed.
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
| Improve this Doc View SourceRenewPublicEndpointAsync(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
Remarks
The returned Lease may have different external address
and/or port than the original lease
.