Share via


InetSocketAddress Constructors

Definition

Overloads

InetSocketAddress(Int32)

Creates a socket address where the IP address is the wildcard address and the port number a specified value.

InetSocketAddress(InetAddress, Int32)

Creates a socket address from an IP address and a port number.

InetSocketAddress(IntPtr, JniHandleOwnership)

A constructor used when creating managed representations of JNI objects; called by the runtime.

InetSocketAddress(String, Int32)

Creates a socket address from a hostname and a port number.

InetSocketAddress(Int32)

Creates a socket address where the IP address is the wildcard address and the port number a specified value.

[Android.Runtime.Register(".ctor", "(I)V", "")]
public InetSocketAddress (int port);
[<Android.Runtime.Register(".ctor", "(I)V", "")>]
new Java.Net.InetSocketAddress : int -> Java.Net.InetSocketAddress

Parameters

port
Int32

The port number

Attributes

Remarks

Creates a socket address where the IP address is the wildcard address and the port number a specified value.

A valid port value is between 0 and 65535. A port number of zero will let the system pick up an ephemeral port in a bind operation.

Java documentation for java.net.InetSocketAddress.InetSocketAddress(int).

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

InetSocketAddress(InetAddress, Int32)

Creates a socket address from an IP address and a port number.

[Android.Runtime.Register(".ctor", "(Ljava/net/InetAddress;I)V", "")]
public InetSocketAddress (Java.Net.InetAddress? addr, int port);
[<Android.Runtime.Register(".ctor", "(Ljava/net/InetAddress;I)V", "")>]
new Java.Net.InetSocketAddress : Java.Net.InetAddress * int -> Java.Net.InetSocketAddress

Parameters

addr
InetAddress

The IP address

port
Int32

The port number

Attributes

Remarks

Creates a socket address from an IP address and a port number.

A valid port value is between 0 and 65535. A port number of zero will let the system pick up an ephemeral port in a bind operation.

A null address will assign the wildcard address.

Java documentation for java.net.InetSocketAddress.InetSocketAddress(java.net.InetAddress, int).

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

InetSocketAddress(IntPtr, JniHandleOwnership)

A constructor used when creating managed representations of JNI objects; called by the runtime.

protected InetSocketAddress (IntPtr javaReference, Android.Runtime.JniHandleOwnership transfer);
new Java.Net.InetSocketAddress : nativeint * Android.Runtime.JniHandleOwnership -> Java.Net.InetSocketAddress

Parameters

javaReference
IntPtr

nativeint

A IntPtrcontaining a Java Native Interface (JNI) object reference.

transfer
JniHandleOwnership

A JniHandleOwnershipindicating how to handle javaReference

Remarks

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

InetSocketAddress(String, Int32)

Creates a socket address from a hostname and a port number.

[Android.Runtime.Register(".ctor", "(Ljava/lang/String;I)V", "")]
public InetSocketAddress (string? hostname, int port);
[<Android.Runtime.Register(".ctor", "(Ljava/lang/String;I)V", "")>]
new Java.Net.InetSocketAddress : string * int -> Java.Net.InetSocketAddress

Parameters

hostname
String

the Host name

port
Int32

The port number

Attributes

Remarks

Creates a socket address from a hostname and a port number.

An attempt will be made to resolve the hostname into an InetAddress. If that attempt fails, the address will be flagged as unresolved.

If there is a security manager, its checkConnect method is called with the host name as its argument to check the permission to resolve it. This could result in a SecurityException.

A valid port value is between 0 and 65535. A port number of zero will let the system pick up an ephemeral port in a bind operation.

Java documentation for java.net.InetSocketAddress.InetSocketAddress(java.lang.String, int).

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