PeerNameResolver.ResolveAsync Method (PeerName, Object)

 

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

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

[HostProtectionAttribute(SecurityAction.LinkDemand, ExternalThreading = true)]
public void ResolveAsync(
	PeerName peerName,
	object userState
)

Parameters

peerName
Type: System.Net.PeerToPeer.PeerName

The PeerName to resolve.

userState
Type: System.Object

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

Exception Condition
ArgumentNullException

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

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.

.NET Framework
Available since 3.5
Return to top
Show: