Skip to content

Latest commit

 

History

History
28 lines (20 loc) · 1.68 KB

streamsocket_transferownership_1291619316.md

File metadata and controls

28 lines (20 loc) · 1.68 KB
-api-id -api-type
M:Windows.Networking.Sockets.StreamSocket.TransferOwnership(System.String)
winrt method

Windows.Networking.Sockets.StreamSocket.TransferOwnership

-description

Transfers ownership of the StreamSocket to the socket brokering service, which monitors socket activity and notifies the app through a background task if there is any activity.

-parameters

-param socketId

A string the app uses to identify the transferred socket. The string should identify this socket uniquely within the app. When activity occurs on this socket, this string will be provided to the app to identify the socket.

-remarks

Your app should call this method to transfer ownership of the StreamSocket to the socket brokering service when the app is about to be suspended, or at the end of a background task. Your app should not access the StreamSocket object after calling this method, except when responding to notifications from the socket brokering service.

Note

This call fails if there is any pending I/O on the StreamSocket. Your code should call StreamSocket.CancelIOAsync to cancel any further new traffic, then handle all pending traffic, and then update the SocketActivityContext, before calling StreamSocket.TransferOwnership.

-examples

-see-also

TransferOwnership(String, SocketActivityContext), TransferOwnership(String, SocketActivityContext, TimeSpan)