UserToken Property

SocketAsyncEventArgs.UserToken Property

[ This article is for Windows Phone 8 developers. If you’re developing for Windows 10, see the latest documentation. ]

Gets or sets a user or application object associated with this asynchronous socket operation.

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

'Declaration
Public Property UserToken As Object

Property Value

Type: System.Object
An object that represents the user or application object associated with this asynchronous socket operation.

This property can be used by an application to associate an application state object with the SocketAsyncEventArgs object. Primarily, this property is a way for an application to pass state to the application’s event handler (for example, the asynchronous operation completion method).

This property is used with all of the asynchronous socket methods: Socket.ConnectAsync, Socket.ReceiveAsync, and Socket.SendAsync.

Windows Phone OS

Supported in: 8.1, 8.0, 7.1

Windows Phone

Show:
© 2017 Microsoft