ConnectivityManager.BindProcessToNetwork(Network) Method

Definition

Binds the current process to network.

[Android.Runtime.Register("bindProcessToNetwork", "(Landroid/net/Network;)Z", "GetBindProcessToNetwork_Landroid_net_Network_Handler", ApiSince=23)]
public virtual bool BindProcessToNetwork (Android.Net.Network? network);
[<Android.Runtime.Register("bindProcessToNetwork", "(Landroid/net/Network;)Z", "GetBindProcessToNetwork_Landroid_net_Network_Handler", ApiSince=23)>]
abstract member BindProcessToNetwork : Android.Net.Network -> bool
override this.BindProcessToNetwork : Android.Net.Network -> bool

Parameters

network
Network

The Network to bind the current process to, or null to clear the current binding.

Returns

true on success, false if the Network is no longer valid.

Attributes

Remarks

Binds the current process to network. All Sockets created in the future (and not explicitly bound via a bound SocketFactory from Network#getSocketFactory() Network.getSocketFactory()) will be bound to network. All host name resolutions will be limited to network as well. Note that if network ever disconnects, all Sockets created in this way will cease to work and all host name resolutions will fail. This is by design so an application doesn't accidentally use Sockets it thinks are still bound to a particular Network. To clear binding pass null for network. Using individually bound Sockets created by Network.getSocketFactory().createSocket() and performing network-specific host name resolutions via Network#getAllByName Network.getAllByName is preferred to calling bindProcessToNetwork.

Java documentation for android.net.ConnectivityManager.bindProcessToNetwork(android.net.Network).

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