# GCKNetworkAddress Class

[Instance Methods](https://developers.google.com/cast/docs/reference/ios/interface_g_c_k_network_address#pub-methods) \| [Class Methods](https://developers.google.com/cast/docs/reference/ios/interface_g_c_k_network_address#pub-static-methods) \| [Properties](https://developers.google.com/cast/docs/reference/ios/interface_g_c_k_network_address#properties) GCKNetworkAddress Class Reference

## Overview

An object that represents a network IP address.

This object is immutable.

Since
:   4.2

Inherits NSObject, \<NSCopying\>, and \<NSSecureCoding\>.

|---|---|
| ## Instance Method Summary ||
| (instancetype) | - [init](https://developers.google.com/cast/docs/reference/ios/interface_g_c_k_network_address#ab05e77557b0ae03be75577907bc97e5e) |
|   | Using the default initializer is not allowed. [More...](https://developers.google.com/cast/docs/reference/ios/interface_g_c_k_network_address#ab05e77557b0ae03be75577907bc97e5e) |
|   ||
| (instancetype) | - [initWithType:ipAddress:](https://developers.google.com/cast/docs/reference/ios/interface_g_c_k_network_address#ab550e2f1dd2520ffe187625ad902af3a) |
|   | Constructs a [GCKNetworkAddress](https://developers.google.com/cast/docs/reference/ios/interface_g_c_k_network_address "An object that represents a network IP address. ") with the given address type and IP address. [More...](https://developers.google.com/cast/docs/reference/ios/interface_g_c_k_network_address#ab550e2f1dd2520ffe187625ad902af3a) |
|   ||
| (instancetype) | - [initWithType:addressData:](https://developers.google.com/cast/docs/reference/ios/interface_g_c_k_network_address#a14918027f26ed09e245989cd8768a609) |
|   | Constructs a [GCKNetworkAddress](https://developers.google.com/cast/docs/reference/ios/interface_g_c_k_network_address "An object that represents a network IP address. ") with the given address type and raw address. [More...](https://developers.google.com/cast/docs/reference/ios/interface_g_c_k_network_address#a14918027f26ed09e245989cd8768a609) |
|   ||

|---|---|
| ## Class Method Summary ||
| ([GCKNetworkAddress](https://developers.google.com/cast/docs/reference/ios/interface_g_c_k_network_address) \*) | + [wildcardAddressOfType:](https://developers.google.com/cast/docs/reference/ios/interface_g_c_k_network_address#a8edce7116e771b3fb8d9477dd083ba1f) |
|   | Constructs a wildcard address of the given type. [More...](https://developers.google.com/cast/docs/reference/ios/interface_g_c_k_network_address#a8edce7116e771b3fb8d9477dd083ba1f) |
|   ||
| ([GCKNetworkAddress](https://developers.google.com/cast/docs/reference/ios/interface_g_c_k_network_address) \*) | + [loopbackAddressOfType:](https://developers.google.com/cast/docs/reference/ios/interface_g_c_k_network_address#a9ef859b586ac3c65563a28c84156e783) |
|   | Constructs a loopback address of the given type. [More...](https://developers.google.com/cast/docs/reference/ios/interface_g_c_k_network_address#a9ef859b586ac3c65563a28c84156e783) |
|   ||
| ([GCKNetworkAddress](https://developers.google.com/cast/docs/reference/ios/interface_g_c_k_network_address) \*) | + [IPv4BroadcastAddress](https://developers.google.com/cast/docs/reference/ios/interface_g_c_k_network_address#a5667798f1aa999fdf27cc7025de4edaf) |
|   | Constructs an IPv4 broadcast address. [More...](https://developers.google.com/cast/docs/reference/ios/interface_g_c_k_network_address#a5667798f1aa999fdf27cc7025de4edaf) |
|   ||
| ([GCKNetworkAddress](https://developers.google.com/cast/docs/reference/ios/interface_g_c_k_network_address) \*) | + [addressWithIPv4Address:](https://developers.google.com/cast/docs/reference/ios/interface_g_c_k_network_address#a93e8b9e77565d0ba756a0ade8be5c997) |
|   | Constructs an IPv4 address. [More...](https://developers.google.com/cast/docs/reference/ios/interface_g_c_k_network_address#a93e8b9e77565d0ba756a0ade8be5c997) |
|   ||
| ([GCKNetworkAddress](https://developers.google.com/cast/docs/reference/ios/interface_g_c_k_network_address) \*) | + [addressWithIPv6Address:](https://developers.google.com/cast/docs/reference/ios/interface_g_c_k_network_address#a971661bca7869f8deffa6995246b4350) |
|   | Constructs an IPv6 address. [More...](https://developers.google.com/cast/docs/reference/ios/interface_g_c_k_network_address#a971661bca7869f8deffa6995246b4350) |
|   ||
| ([GCKNetworkAddress](https://developers.google.com/cast/docs/reference/ios/interface_g_c_k_network_address) \*) | + [addressWithIPCPath:](https://developers.google.com/cast/docs/reference/ios/interface_g_c_k_network_address#a9e091eabb9e33dc0171629d4570a44cd) |
|   | Constructs an IPC address. [More...](https://developers.google.com/cast/docs/reference/ios/interface_g_c_k_network_address#a9e091eabb9e33dc0171629d4570a44cd) |
|   ||

|---|---|
| ## Property Summary ||
| GCKNetworkAddressType | [type](https://developers.google.com/cast/docs/reference/ios/interface_g_c_k_network_address#a14ecf1ab928fa1a8f02a56c1ec31ab50) |
|   | The address type. [More...](https://developers.google.com/cast/docs/reference/ios/interface_g_c_k_network_address#a14ecf1ab928fa1a8f02a56c1ec31ab50) |
|   ||
| NSString \* | [ipAddress](https://developers.google.com/cast/docs/reference/ios/interface_g_c_k_network_address#ab5854b4b34ca8e73ea36b19e2c13eefe) |
|   | The IP address. [More...](https://developers.google.com/cast/docs/reference/ios/interface_g_c_k_network_address#ab5854b4b34ca8e73ea36b19e2c13eefe) |
|   ||
| NSData \* | [addressData](https://developers.google.com/cast/docs/reference/ios/interface_g_c_k_network_address#a7d9d0e24e3769ab579e70e588bae8ad8) |
|   | The network address as an NSData containing the appropriate address structure (e.g., struct in_addr or struct in6_addr). [More...](https://developers.google.com/cast/docs/reference/ios/interface_g_c_k_network_address#a7d9d0e24e3769ab579e70e588bae8ad8) |
|   ||

## Method Detail

|---|---|---|---|
| - (instancetype) init |   |   |   |

Using the default initializer is not allowed.

|---|---|---|---|
| - (instancetype) initWithType: |   | (GCKNetworkAddressType) | *type* |
| ipAddress: |   | (nullable NSString \*) | *ipAddress* |
|   |   |   |   |

Constructs a [GCKNetworkAddress](https://developers.google.com/cast/docs/reference/ios/interface_g_c_k_network_address "An object that represents a network IP address. ") with the given address type and IP address.

Parameters
:

    |---|---|
    | type | The address type. |
    | ipAddress | The IP address, in textual form. May be `nil` to indicate the wildcard ("any") address. |


|---|---|---|---|
| - (instancetype) initWithType: |   | (GCKNetworkAddressType) | *type* |
| addressData: |   | (nullable NSData \*) | *addressData* |
|   |   |   |   |

Constructs a [GCKNetworkAddress](https://developers.google.com/cast/docs/reference/ios/interface_g_c_k_network_address "An object that represents a network IP address. ") with the given address type and raw address.

Parameters
:

    |---|---|
    | type | The address type. |
    | addressData | An NSData object containing the appropriate address structure (e.g., struct in_addr or struct in6_addr). For the GCKNNetworkAddressTypeIPC, the data is expected to be a UTF8 encoding. |


|---|---|---|---|---|
| + ([GCKNetworkAddress](https://developers.google.com/cast/docs/reference/ios/interface_g_c_k_network_address) \*) wildcardAddressOfType: |   | (GCKNetworkAddressType) | *type* |   |

Constructs a wildcard address of the given type.

|---|---|---|---|---|
| + ([GCKNetworkAddress](https://developers.google.com/cast/docs/reference/ios/interface_g_c_k_network_address) \*) loopbackAddressOfType: |   | (GCKNetworkAddressType) | *type* |   |

Constructs a loopback address of the given type.

|---|---|---|---|
| + ([GCKNetworkAddress](https://developers.google.com/cast/docs/reference/ios/interface_g_c_k_network_address) \*) IPv4BroadcastAddress |   |   |   |

Constructs an IPv4 broadcast address.

|---|---|---|---|---|
| + ([GCKNetworkAddress](https://developers.google.com/cast/docs/reference/ios/interface_g_c_k_network_address) \*) addressWithIPv4Address: |   | (NSString \*) | *ipAddress* |   |

Constructs an IPv4 address.

|---|---|---|---|---|
| + ([GCKNetworkAddress](https://developers.google.com/cast/docs/reference/ios/interface_g_c_k_network_address) \*) addressWithIPv6Address: |   | (NSString \*) | *ipAddress* |   |

Constructs an IPv6 address.

|---|---|---|---|---|
| + ([GCKNetworkAddress](https://developers.google.com/cast/docs/reference/ios/interface_g_c_k_network_address) \*) addressWithIPCPath: |   | (NSString \*) | *path* |   |

Constructs an IPC address.

## Property Detail

|---|---|
| |---| | - (GCKNetworkAddressType) type | | readnonatomicassign |

The address type.

|---|---|
| |---| | - (NSString\*) ipAddress | | readnonatomiccopy |

The IP address.

|---|---|
| |---| | - (NSData\*) addressData | | readnonatomiccopy |

The network address as an NSData containing the appropriate address structure (e.g., struct in_addr or struct in6_addr).

For the address type IPC, this field is a UTF8 encoding.