# Print output for @column tags ?> IpSecManager.UdpEncapsulationSocket - Android SDK | Android Developers

Most visited

Recently visited

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

Public methods

close

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

public FileDescriptor getFileDescriptor ()

Get the encapsulation socket's file descriptor.

Returns
FileDescriptor

getPort

public int getPort ()

Get the bound port of the wrapped socket.

Returns
int

toString

public String toString ()

Returns a string representation of the object. In general, the toString method returns a string that "textually represents" this object. The result should be a concise but informative representation that is easy for a person to read. It is recommended that all subclasses override this method.

The toString method for class Object returns a string consisting of the name of the class of which the object is an instance, the at-sign character `@', and the unsigned hexadecimal representation of the hash code of the object. In other words, this method returns a string equal to the value of:

 getClass().getName() + '@' + Integer.toHexString(hashCode())
 

Returns
String a string representation of the object.

Protected methods

finalize

protected void finalize ()

Check that the socket was closed properly.

Throws
Throwable