ServerSocket.LocalPort Property

Definition

Returns the port number on which this socket is listening.

public virtual int LocalPort { [Android.Runtime.Register("getLocalPort", "()I", "GetGetLocalPortHandler")] get; }
[<get: Android.Runtime.Register("getLocalPort", "()I", "GetGetLocalPortHandler")>]
member this.LocalPort : int

Property Value

the port number to which this socket is listening or -1 if the socket is not bound yet.

Attributes

Remarks

Returns the port number on which this socket is listening.

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

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

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