VpnChannel.AddAndAssociateTransport(Object, Object) VpnChannel.AddAndAssociateTransport(Object, Object) VpnChannel.AddAndAssociateTransport(Object, Object) VpnChannel.AddAndAssociateTransport(Object, Object) Method

Definition

Prepares, marks, and creates the transport for use by the VPN framework as a transport link communicating the VPN plug-in to the VPN server. This call must be performed before any other operations related to the VPN framework APIs.

public : void AddAndAssociateTransport(Platform::Object transport, Platform::Object context)
void AddAndAssociateTransport(winrt::Windows::Foundation::IInspectable transport, winrt::Windows::Foundation::IInspectable context) const;
public void AddAndAssociateTransport(Object transport, Object context)
Public Sub AddAndAssociateTransport(transport As Object, context As Object)

Parameters

transport
Object Object

An IInspectable object for socket transport. This object can be a Windows.Networking.StreamSocket, a Windows.Networking.StreamWebSocket, or a Windows.Networking.DatagramSocket. This socket will control the connection to the VPN server and will be used to send encapsulated IP packets and receive encapsulated data. The socket must be unconnected at the point of the call.

context
Object Object

The transport context object to use, for example the name of a host or server.

Additional features and requirements

Device family
Windows 10, version 1803 (introduced v10.0.17134.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v6)
Capabilities
networkingVpnProvider

Remarks

If the function succeeds, the return value is S_OK, otherwise the function will return an error hresult value describing the specific failure. If the plug-in is not connected, the error will be E_ACCESSDENIED.

Note

Any call to this API outside of a connected VPN plug-in will fail, as activity and interactions between the VPN plug-in and the system are controlled by the VPN profile. The call will fail if the VPN framework does not support the specified type of transport implemented by the transport object. The socket must have not been connected at the time of this call, otherwise the call will fail with an invalid parameter error.

A plugin may choose between the following combinations of sockets: