Export (0) Print
Expand All

PeerNameResolver.ResolveAsync Method (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.

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

[HostProtectionAttribute(SecurityAction.LinkDemand, ExternalThreading = true)]
public void ResolveAsync(
	PeerName peerName,
	Cloud cloud,
	int maxRecords,
	Object userState
)

Parameters

peerName
Type: System.Net.PeerToPeer.PeerName

The peerName to resolve.

cloud
Type: System.Net.PeerToPeer.Cloud

The cloud in which to resolve peerName.

maxRecords
Type: System.Int32

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

userState
Type: System.Object

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

ExceptionCondition
ArgumentNullException

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

ArgumentException

One or more supplied parameters are invalid.

PeerToPeerException

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

ArgumentOutOfRangeException

The maxRecords parameter is less than or equal to zero.

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.

NoteNote

The HostProtectionAttribute attribute applied to this type or member has the following Resources property value: ExternalThreading. The HostProtectionAttribute does not affect desktop applications (which are typically started by double-clicking an icon, typing a command, or entering a URL in a browser). For more information, see the HostProtectionAttribute class or SQL Server Programming and Host Protection Attributes.

.NET Framework

Supported in: 4.6, 4.5, 4, 3.5

.NET Framework Client Profile

Supported in: 4, 3.5 SP1

Windows 8.1, Windows Server 2012 R2, Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

Show:
© 2014 Microsoft