Share via


ServerSocket.LocalSocketAddress Property

Definition

Returns the address of the endpoint this socket is bound to.

public virtual Java.Net.SocketAddress? LocalSocketAddress { [Android.Runtime.Register("getLocalSocketAddress", "()Ljava/net/SocketAddress;", "GetGetLocalSocketAddressHandler")] get; }
[<get: Android.Runtime.Register("getLocalSocketAddress", "()Ljava/net/SocketAddress;", "GetGetLocalSocketAddressHandler")>]
member this.LocalSocketAddress : Java.Net.SocketAddress

Property Value

a SocketAddress representing the local endpoint of this socket, or a SocketAddress representing the loopback address if denied by the security manager, or null if the socket is not bound yet.

Attributes

Remarks

Returns the address of the endpoint this socket is bound to.

If the socket was bound prior to being #close closed, then this method will continue to return the address of the endpoint after the socket is closed.

If there is a security manager set, its checkConnect method is called with the local address and -1 as its arguments to see if the operation is allowed. If the operation is not allowed, a SocketAddress representing the InetAddress#getLoopbackAddress loopback address and the local port to which the socket is bound is returned.

Added in 1.4.

Java documentation for java.net.ServerSocket.getLocalSocketAddress().

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