Compartir a través de


VpnService.Protect Method

Definition

Overloads

Protect(DatagramSocket)

Convenience method to protect a DatagramSocket from VPN connections.

Protect(Socket)

Convenience method to protect a Socket from VPN connections.

Protect(Int32)

Protect a socket from VPN connections.

Protect(DatagramSocket)

Convenience method to protect a DatagramSocket from VPN connections.

[Android.Runtime.Register("protect", "(Ljava/net/DatagramSocket;)Z", "GetProtect_Ljava_net_DatagramSocket_Handler")]
public virtual bool Protect (Java.Net.DatagramSocket? socket);
[<Android.Runtime.Register("protect", "(Ljava/net/DatagramSocket;)Z", "GetProtect_Ljava_net_DatagramSocket_Handler")>]
abstract member Protect : Java.Net.DatagramSocket -> bool
override this.Protect : Java.Net.DatagramSocket -> bool

Parameters

Returns

true on success.

Attributes

Remarks

Convenience method to protect a DatagramSocket from VPN connections.

Java documentation for android.net.VpnService.protect(java.net.DatagramSocket).

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

See also

Applies to

Protect(Socket)

Convenience method to protect a Socket from VPN connections.

[Android.Runtime.Register("protect", "(Ljava/net/Socket;)Z", "GetProtect_Ljava_net_Socket_Handler")]
public virtual bool Protect (Java.Net.Socket? socket);
[<Android.Runtime.Register("protect", "(Ljava/net/Socket;)Z", "GetProtect_Ljava_net_Socket_Handler")>]
abstract member Protect : Java.Net.Socket -> bool
override this.Protect : Java.Net.Socket -> bool

Parameters

socket
Socket

Returns

true on success.

Attributes

Remarks

Convenience method to protect a Socket from VPN connections.

Java documentation for android.net.VpnService.protect(java.net.Socket).

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

See also

Applies to

Protect(Int32)

Protect a socket from VPN connections.

[Android.Runtime.Register("protect", "(I)Z", "GetProtect_IHandler")]
public virtual bool Protect (int socket);
[<Android.Runtime.Register("protect", "(I)Z", "GetProtect_IHandler")>]
abstract member Protect : int -> bool
override this.Protect : int -> bool

Parameters

socket
Int32

Returns

true on success.

Attributes

Remarks

Protect a socket from VPN connections. After protecting, data sent through this socket will go directly to the underlying network, so its traffic will not be forwarded through the VPN. This method is useful if some connections need to be kept outside of VPN. For example, a VPN tunnel should protect itself if its destination is covered by VPN routes. Otherwise its outgoing packets will be sent back to the VPN interface and cause an infinite loop. This method will fail if the application is not prepared or is revoked.

<p class="note">The socket is NOT closed by this method.

Java documentation for android.net.VpnService.protect(int).

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to