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:
 virtual void AddAndAssociateTransport(Platform::Object ^ transport, Platform::Object ^ context) = AddAndAssociateTransport;
void AddAndAssociateTransport(IInspectable const& transport, IInspectable const& context);
public void AddAndAssociateTransport(object transport, object context);
function addAndAssociateTransport(transport, context)
Public Sub AddAndAssociateTransport (transport As Object, context As Object)

Parameters

transport
Object

Platform::Object

IInspectable

An IInspectable object for socket transport. This object can be a Windows.Networking.Sockets.StreamSocket 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

Platform::Object

IInspectable

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

Windows requirements

Device family
Windows 10, version 1803 (introduced in 10.0.17134.0)
API contract
Windows.Foundation.UniversalApiContract (introduced in v6.0)
App 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.

Applies to