IpSecManager.UdpEncapsulationSocket


public static final class IpSecManager.UdpEncapsulationSocket
extends Object implements AutoCloseable

java.lang.Object
   ↳ android.net.IpSecManager.UdpEncapsulationSocket


This class provides access to a UDP encapsulation Socket.

UdpEncapsulationSocket wraps a system-provided datagram socket intended for IKEv2 signalling and UDP encapsulated IPsec traffic. Instances can be obtained by calling IpSecManager.openUdpEncapsulationSocket(). The provided socket cannot be re-bound by the caller. The caller should not close the FileDescriptor returned by getFileDescriptor(), but should use close() instead.

Allowing the user to close or unbind a UDP encapsulation socket could impact the traffic of the next user who binds to that port. To prevent this scenario, these sockets are held open by the system so that they may only be closed by calling close() or when the user process exits.

Summary

Public methods

void close()

Close this socket.

FileDescriptor getFileDescriptor()

Get the encapsulation socket's file descriptor.

int getPort()

Get the bound port of the wrapped socket.

String toString()

Returns a string representation of the object.

Protected methods

void finalize()

Check that the socket was closed properly.

Inherited methods

Object clone()

Creates and returns a copy of this object.

boolean equals(Object obj)

Indicates whether some other object is "equal to" this one.

void finalize()

Called by the garbage collector on an object when garbage collection determines that there are no more references to the object.

final Class<?> getClass()

Returns the runtime class of this Object.

int hashCode()

Returns a hash code value for the object.

final void notify()

Wakes up a single thread that is waiting on this object's monitor.

final void notifyAll()

Wakes up all threads that are waiting on this object's monitor.

String toString()

Returns a string representation of the object.

final void wait(long timeoutMillis, int nanos)

Causes the current thread to wait until it is awakened, typically by being notified or interrupted, or until a certain amount of real time has elapsed.

final void wait(long timeoutMillis)

Causes the current thread to wait until it is awakened, typically by being notified or interrupted, or until a certain amount of real time has elapsed.

final void wait()

Causes the current thread to wait until it is awakened, typically by being notified or interrupted.

abstract void close()

Closes this resource, relinquishing any underlying resources.

Public methods

close

Added in API level 28
public void close ()

Close this socket.

This closes the wrapped socket. Open encapsulation sockets count against a user's resource limits, and forgetting to close them eventually will result in ResourceUnavailableException being thrown.

Throws
IOException

getFileDescriptor

Added in API level 28
public FileDescriptor getFileDescriptor ()

Get the encapsulation socket's file descriptor.

Returns
FileDescriptor

getPort

Added in API level 28
public int getPort ()

Get the bound port of the wrapped socket.

Returns
int

toString

Added in API level 28
public String toString ()

Returns a string representation of the object.

Returns
String a string representation of the object.

Protected methods

finalize

Added in API level 28
protected void finalize ()

Check that the socket was closed properly.

Throws
Throwable