ResolveAsyncCancel Method
Collapse the table of content
Expand the table of content

PeerNameResolver.ResolveAsyncCancel Method (Object)


Cancels the specified asynchronous peer name resolution request.

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

public void ResolveAsyncCancel(
	object userState


Type: System.Object

The object provided to the ResolveAsync method instance which started the resolve operation.

This method does not return a value.

Exception Condition

The userState parameters cannot be null.

Calling this method guarantees the system will not attempt to obtain additional records for the specified PeerName. If this method is called when an asynchronous peer name resolution operation is not outstanding, it acts as a "no operation" (NO OP).

The userState object must be provided since it is used to track a specific asynchronous call when multiple calls are in progress. This caller-supplied object is unique for each peer name resolution request.

This method will return immediately, but the operation may or may not immediately cancel. The event arguments returned by the ResolveCompleted event contains a field which can be polled by clients to determine whether cancellation occurred.

Calling this method ensures the ResolveCompleted event will be signaled as soon as possible with the event argument Cancelled set to true.

.NET Framework
Available since 3.5
Return to top
© 2016 Microsoft