Socket.LocalPort Property

Definition

Returns the local port number to which this socket is bound.

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 local port number to which this socket is bound or -1 if the socket is not bound yet.

Attributes

Remarks

Returns the local port number to which this socket is bound.

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

Java documentation for java.net.Socket.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