PeerContact.InviteAsync Method (PeerEndPoint, String, Byte[], PeerApplication, Object)

 
System_CAPS_noteNote

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

Begins an asynchronous invitation operation for the specified peerEndPoint to join the specified collaboration PeerApplication sponsored by the sender of the invitation.

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

[SecurityCriticalAttribute]
public void InviteAsync(
	PeerEndPoint peerEndPoint,
	string message,
	byte[] invitationData,
	PeerApplication applicationToInvite,
	object userToken
)

Parameters

peerEndPoint
Type: System.Net.PeerToPeer.Collaboration.PeerEndPoint

The endpoint or remote peer to which to send the invitation.

message
Type: System.String

A message to send to the remote peer along with the application invitation. The message can be no more than 255 Unicode characters.

invitationData
Type: System.Byte[]

A user defined data blob to associate with the invitation. Its size can be no more than 16,384 bytes.

applicationToInvite
Type: System.Net.PeerToPeer.Collaboration.PeerApplication

The application for which the invitation is sent.

userToken
Type: System.Object

User-defined object to pass to the callback of the asynchronous operation. Also used to identify the asynchronous operation for cancellation. This parameter must be specified and is unique across all asynchronous invitation operations in progress.

Exception Condition
ArgumentException
  • UserToken cannot be null.

  • Endpoint specified by peerEndPoint cannot be null.

ArgumentNullException

PeerApplication and PeerEndPoint objects cannot be null.

ObjectDisposedException

The PeerEndPoint object has been disposed.

PeerToPeerException

The Id for the current application does not exist or is empty.

The caller is not required to sign-in to the System.Net.PeerToPeer.Collaboration infrastructure for this method to complete successfully. A PeerInvitationResponse from the invitee is not the same as the invitee accepting the invitation to collaborate. If an invitation is sent to a remote peer that has not installed the application, the invitation is automatically declined.

Notes to Callers:

Additional overloads are defined on the Peer class instead of the subclasses PeerContact and PeerNearMe.

Calling this method requires a PermissionState of Unrestricted. This state is created when the peer collaboration session begins.

.NET Framework
Available since 3.5
Return to top
Show: