PeerNameRegistration Constructor (PeerName, Int32)


The .NET API Reference documentation has a new home. Visit the .NET API Browser on to see the new experience.

Initializes a new instance of the PeerNameRegistration class with the specified name and port number.

Namespace:   System.Net.PeerToPeer
Assembly:  System.Net (in System.Net.dll)

public PeerNameRegistration(
	PeerName name,
	int port


Type: System.Net.PeerToPeer.PeerName

The PeerName object to register.

Type: System.Int32

Integer value that specifies the port number to register.

Exception Condition

The name parameter cannot be null.


The specified port number is less than zero. Port numbers must be greater than or equal to zero and less than 65,535 (0xFFFF).

  • The PeerName specified has already been registered from this host.

  • The remote peer does not own the Authority for the supplied PeerName object.

Calling this constructor creates an instance that will be used to register all source addresses (both IPv6and IPv4) and the provided port for all clouds in which the peer is currently participating. If the object is constructed successfully, the specified PeerName and Port are populated.

If the peer name is secured and was previously registered in a Cloud the peer is currently participating in, an PeerToPeerException is thrown.

This constructor only creates a PeerNameRegistration instance; it does not perform the registration. After instantiating the registration object with this constructor and populating its fields, the application must call Start to perform the actual registration.

.NET Framework
Available since 3.5
Return to top