Редагувати

Поділитися через


PeerNameResolver.ResolveAsync Method

Definition

These methods begin an asynchronous resolution operation for the specified PeerName in all clouds known to the calling peer.

Overloads

ResolveAsync(PeerName, Object)

Begins an asynchronous peer name resolution operation for the specified PeerName in all clouds known to the calling peer.

ResolveAsync(PeerName, Int32, Object)

Begins an asynchronous peer name resolution operation for the specified PeerName in all clouds known to the calling peer, returning no more than maxRecords entries for the peer name.

ResolveAsync(PeerName, Cloud, Object)

Begins an asynchronous peer name resolution operation for the specified PeerName in the specified Cloud.

ResolveAsync(PeerName, Cloud, Int32, Object)

Begins an asynchronous peer name resolution operation for the specified PeerName in the specified Cloud. The resolution operation will resolve no more than maxRecords entries for the specified peer name.

Remarks

For every Resolve method, there is an equivalent ResolveAsync method, which is used when asynchronous processing is required. They are identical in the parameters they are passed, except that ResolveAsync includes a system token in its parameter list for event handling.

If a parameter mismatch occurs between the Resolve method and the ResolveAsync method, and the Cloud parameter is not supplied, the method uses the Available shortcut to fill in cloud parameters.

ResolveAsync(PeerName, Object)

Begins an asynchronous peer name resolution operation for the specified PeerName in all clouds known to the calling peer.

public:
 void ResolveAsync(System::Net::PeerToPeer::PeerName ^ peerName, System::Object ^ userState);
public void ResolveAsync (System.Net.PeerToPeer.PeerName peerName, object userState);
member this.ResolveAsync : System.Net.PeerToPeer.PeerName * obj -> unit
Public Sub ResolveAsync (peerName As PeerName, userState As Object)

Parameters

peerName
PeerName

The PeerName to resolve.

userState
Object

A user-defined object that contains state information about the peer name resolution operation.

Exceptions

One or both of the peerName and userState parameters are set to null.

Remarks

This method asynchronously associates a peer name to clouds. All clouds are queried for the PeerName. It raises the ResolveCompleted event, which calls back to the OnResolveCompleted method. Or, it raises the ResolveProgressChanged event, which calls back to the OnResolveProgressChanged method.

If the peer name cannot be resolved, an PeerToPeerException is thrown.

For unsecured peer names, the same name can be registered (and associated with different endpoints) by different peers within the same cloud.

Calling the PeerNameResolver method is similar to calling the ResolveAsync method for each peer name record in the PeerNameRecordCollection. Note that using the Resolve method on an individual peer name record does not invalidate resolving multiple peer names.

For every ResolveAsync method, there is an equivalent Resolve method. Their parameter lists are identical, except that the ResolveAsync method includes a system token for asynchronous event handling, and the Resolve method is intended for synchronous processing.

All asynchronous references to the resolver object are coordinated with a unique identifier token. This userState token or message identifier allows an operating system to deliver a message to a single receiving process after the message has been placed on the message queue.

The ResolveCompleted event will be raised if the resolve operation completes in error or is canceled.

Applies to

ResolveAsync(PeerName, Int32, Object)

Begins an asynchronous peer name resolution operation for the specified PeerName in all clouds known to the calling peer, returning no more than maxRecords entries for the peer name.

public:
 void ResolveAsync(System::Net::PeerToPeer::PeerName ^ peerName, int maxRecords, System::Object ^ userState);
public void ResolveAsync (System.Net.PeerToPeer.PeerName peerName, int maxRecords, object userState);
member this.ResolveAsync : System.Net.PeerToPeer.PeerName * int * obj -> unit
Public Sub ResolveAsync (peerName As PeerName, maxRecords As Integer, userState As Object)

Parameters

peerName
PeerName

The PeerName to resolve.

maxRecords
Int32

The maximum number of records to obtain for the Peer Name.

userState
Object

A user-defined object that contains information about the resolve operation.

Exceptions

One or both of the peerName and userState parameters are set to null.

The maxRecords parameter is less than or equal to zero.

Remarks

This method asynchronously associates a peer name to clouds. All clouds are queried for the PeerName. For unsecured peer names, the same name can be registered (and associated with different endpoints) by different peers within the same cloud. If the peer name cannot be resolved or is null, an PeerToPeerException is thrown.

This method raises the ResolveCompleted event, which calls back to the OnResolveCompleted method. Or, it raises the ResolveProgressChanged event, which calls back to the OnResolveProgressChanged method.

For every ResolveAsync method, there is an equivalent Resolve method. Their parameter lists are identical, except that the ResolveAsync method includes a system token for asynchronous event handling, and the Resolve method is intended for synchronous processing.

All asynchronous references to the resolver object are coordinated with a unique identifier token Object. This userState token or message identifier allows an operating system to deliver a message to a single receiving process after the message has been placed on the message queue.

The ResolveCompleted event will be raised if the resolve operation completes in error or is canceled.

Applies to

ResolveAsync(PeerName, Cloud, Object)

Begins an asynchronous peer name resolution operation for the specified PeerName in the specified Cloud.

public:
 void ResolveAsync(System::Net::PeerToPeer::PeerName ^ peerName, System::Net::PeerToPeer::Cloud ^ cloud, System::Object ^ userState);
public void ResolveAsync (System.Net.PeerToPeer.PeerName peerName, System.Net.PeerToPeer.Cloud cloud, object userState);
member this.ResolveAsync : System.Net.PeerToPeer.PeerName * System.Net.PeerToPeer.Cloud * obj -> unit
Public Sub ResolveAsync (peerName As PeerName, cloud As Cloud, userState As Object)

Parameters

peerName
PeerName

The PeerName to resolve.

cloud
Cloud

The Cloud in which to resolve the peerName.

userState
Object

A user-defined Object that contains information about the peer name resolution operation.

Exceptions

One or both of the peerName and userState parameters are set to null.

Remarks

This method raises the ResolveCompleted event, which calls back to the OnResolveCompleted method. Or, it raises the ResolveProgressChanged event, which calls back to the OnResolveProgressChanged method.

For unsecured peer names, the same name can be registered (and associated with different endpoints) by different peers within the same cloud.

If the Cloud parameter is null, the name is resolved using the Available shortcut, which initializes default values for the Name, Scope, and ScopeId properties.

For every ResolveAsync method, there is an equivalent Resolve method. Their parameter lists are identical, except that the ResolveAsync method includes a system token for asynchronous event handling, and the Resolve method is intended for synchronous processing.

All asynchronous references to the resolver object are coordinated with a unique identifier token. This userState token or message identifier allows an operating system to deliver a message to a single receiving process after the message has been placed on the message queue.

The ResolveCompleted event will be raised if the resolve operation completes in error or is canceled.

Applies to

ResolveAsync(PeerName, Cloud, Int32, Object)

Begins an asynchronous peer name resolution operation for the specified PeerName in the specified Cloud. The resolution operation will resolve no more than maxRecords entries for the specified peer name.

public:
 void ResolveAsync(System::Net::PeerToPeer::PeerName ^ peerName, System::Net::PeerToPeer::Cloud ^ cloud, int maxRecords, System::Object ^ userState);
[System.Security.SecurityCritical]
public void ResolveAsync (System.Net.PeerToPeer.PeerName peerName, System.Net.PeerToPeer.Cloud cloud, int maxRecords, object userState);
[<System.Security.SecurityCritical>]
member this.ResolveAsync : System.Net.PeerToPeer.PeerName * System.Net.PeerToPeer.Cloud * int * obj -> unit
Public Sub ResolveAsync (peerName As PeerName, cloud As Cloud, maxRecords As Integer, userState As Object)

Parameters

peerName
PeerName

The peerName to resolve.

cloud
Cloud

The cloud in which to resolve peerName.

maxRecords
Int32

The maximum number of records to obtain from cloud for peerName.

userState
Object

A user-defined object that contains information about the peer name resolution operation.

Attributes

Exceptions

One or both of the peerName and userState parameters are set to null.

One or more supplied parameters are invalid.

Successful completion of this operation requires at least one event handler.

The maxRecords parameter is less than or equal to zero.

Remarks

For unsecured peer names, the same name can be registered (and associated with different endpoints) by different peers within the same cloud.

This method raises the ResolveCompleted event, which calls back to the OnResolveCompleted method. Or, it raises the ResolveProgressChanged event, which calls back to the OnResolveProgressChanged method.

If the Cloud parameter is null, the name is resolved using the Available shortcut, which initializes default values for the Name, Scope, and ScopeId properties.

For every ResolveAsync method, there is an equivalent Resolve method. Their parameter lists are identical, except that the ResolveAsync method includes a system token for asynchronous event handling, and the Resolve method is intended for synchronous processing.

All asynchronous references to the peer resolver object are coordinated with a unique identifier token Object. This userState token or message identifier allows an operating system to deliver a message to a single receiving process after the message has been placed on the message queue.

The ResolveCompleted event will be raised if the resolve operation completes in error or is canceled.

Applies to