Udostępnij za pośrednictwem


StreamSocket.TransferOwnership Method

Definition

Overloads

TransferOwnership(String)

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.

TransferOwnership(String, SocketActivityContext)

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. Specifies a new SocketActivityContext for the socket.

TransferOwnership(String, SocketActivityContext, TimeSpan)

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. Specifies a new SocketActivityContext and a keep alive time for the socket.

TransferOwnership(String)

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.

public:
 virtual void TransferOwnership(Platform::String ^ socketId) = TransferOwnership;
/// [Windows.Foundation.Metadata.Overload("TransferOwnership")]
void TransferOwnership(winrt::hstring const& socketId);
[Windows.Foundation.Metadata.Overload("TransferOwnership")]
public void TransferOwnership(string socketId);
function transferOwnership(socketId)
Public Sub TransferOwnership (socketId As String)

Parameters

socketId
String

Platform::String

winrt::hstring

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.

Attributes

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.

See also

Applies to

TransferOwnership(String, SocketActivityContext)

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. Specifies a new SocketActivityContext for the socket.

public:
 virtual void TransferOwnership(Platform::String ^ socketId, SocketActivityContext ^ data) = TransferOwnership;
/// [Windows.Foundation.Metadata.Overload("TransferOwnershipWithContext")]
void TransferOwnership(winrt::hstring const& socketId, SocketActivityContext const& data);
[Windows.Foundation.Metadata.Overload("TransferOwnershipWithContext")]
public void TransferOwnership(string socketId, SocketActivityContext data);
function transferOwnership(socketId, data)
Public Sub TransferOwnership (socketId As String, data As SocketActivityContext)

Parameters

socketId
String

Platform::String

winrt::hstring

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.

data
SocketActivityContext

Use the SocketActivityContext to pass context information through the socket broker. When your app is notified by the broker of activity, this SocketActivityContext will be provided to your app to help establish the context in which you should handle the notification.

Attributes

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.

See also

Applies to

TransferOwnership(String, SocketActivityContext, TimeSpan)

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. Specifies a new SocketActivityContext and a keep alive time for the socket.

public:
 virtual void TransferOwnership(Platform::String ^ socketId, SocketActivityContext ^ data, TimeSpan keepAliveTime) = TransferOwnership;
/// [Windows.Foundation.Metadata.Overload("TransferOwnershipWithContextAndKeepAliveTime")]
void TransferOwnership(winrt::hstring const& socketId, SocketActivityContext const& data, TimeSpan const& keepAliveTime);
[Windows.Foundation.Metadata.Overload("TransferOwnershipWithContextAndKeepAliveTime")]
public void TransferOwnership(string socketId, SocketActivityContext data, System.TimeSpan keepAliveTime);
function transferOwnership(socketId, data, keepAliveTime)
Public Sub TransferOwnership (socketId As String, data As SocketActivityContext, keepAliveTime As TimeSpan)

Parameters

socketId
String

Platform::String

winrt::hstring

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.

data
SocketActivityContext

Use the SocketActivityContext to pass context information through the socket broker. When your app is notified by the broker of activity, this SocketActivityContext will be provided to your app to help establish the context in which you should handle the notification.

keepAliveTime
TimeSpan TimeSpan

How long the socket brokering service should monitor the socket for activity.

Attributes

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.

See also

Applies to