InetAddress.GetByAddress Method

Definition

Overloads

GetByAddress(Byte[])

Returns an InetAddress object given the raw IP address .

GetByAddress(String, Byte[])

Creates an InetAddress based on the provided host name and IP address.

GetByAddress(Byte[])

Returns an InetAddress object given the raw IP address .

[Android.Runtime.Register("getByAddress", "([B)Ljava/net/InetAddress;", "")]
public static Java.Net.InetAddress GetByAddress (byte[]? addr);
[<Android.Runtime.Register("getByAddress", "([B)Ljava/net/InetAddress;", "")>]
static member GetByAddress : byte[] -> Java.Net.InetAddress

Parameters

addr
Byte[]

the raw IP address in network byte order

Returns

an InetAddress object created from the raw IP address.

Attributes

Exceptions

Remarks

Returns an InetAddress object given the raw IP address . The argument is in network byte order: the highest order byte of the address is in getAddress()[0].

This method doesn't block, i.e. no reverse name service lookup is performed.

IPv4 address byte array must be 4 bytes long and IPv6 byte array must be 16 bytes long

Added in 1.4.

Java documentation for java.net.InetAddress.getByAddress(byte[]).

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

GetByAddress(String, Byte[])

Creates an InetAddress based on the provided host name and IP address.

[Android.Runtime.Register("getByAddress", "(Ljava/lang/String;[B)Ljava/net/InetAddress;", "")]
public static Java.Net.InetAddress GetByAddress (string? host, byte[]? addr);
[<Android.Runtime.Register("getByAddress", "(Ljava/lang/String;[B)Ljava/net/InetAddress;", "")>]
static member GetByAddress : string * byte[] -> Java.Net.InetAddress

Parameters

host
String

the specified host

addr
Byte[]

the raw IP address in network byte order

Returns

an InetAddress object created from the raw IP address.

Attributes

Exceptions

if ipAddress is null or the wrong length.

Remarks

Creates an InetAddress based on the provided host name and IP address. No name service is checked for the validity of the address.

The host name can either be a machine name, such as "java.sun.com", or a textual representation of its IP address.

No validity checking is done on the host name either.

If addr specifies an IPv4 address an instance of Inet4Address will be returned; otherwise, an instance of Inet6Address will be returned.

IPv4 address byte array must be 4 bytes long and IPv6 byte array must be 16 bytes long

Added in 1.4.

Java documentation for java.net.InetAddress.getByAddress(java.lang.String, byte[]).

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