## GInetSocketAddress GInetSocketAddress — Internet GSocketAddress |

## Functions

GSocketAddress * | g_inet_socket_address_new ()
GSocketAddress * | g_inet_socket_address_new_from_string ()
GInetAddress * | g_inet_socket_address_get_address ()
guint16 | g_inet_socket_address_get_port ()
guint32 | g_inet_socket_address_get_flowinfo ()
guint32 | g_inet_socket_address_get_scope_id ()

## Properties

GInetAddress * | address | Read / Write / Construct Only
guint | flowinfo | Read / Write / Construct Only
guint | port | Read / Write / Construct Only
guint | scope-id | Read / Write / Construct Only

## Types and Values

| GInetSocketAddress

## Object Hierarchy

        GObject
        ╰── GSocketAddress
            ╰── GInetSocketAddress
                ╰── GProxyAddress

## Implemented Interfaces

GInetSocketAddress implements GSocketConnectable.

## Includes

    #include <gio/gio.h>

## Description

An IPv4 or IPv6 socket address; that is, the combination of a GInetAddress and a port number.

## Functions

### g_inet_socket_address_new ()

    GSocketAddress *
    g_inet_socket_address_new (GInetAddress *address,
                               guint16 port);

Creates a new GInetSocketAddress for `address` and `port` .

#### Parameters

address | a GInetAddress |
port | a port number |

#### Returns

a new GInetSocketAddress

Since: 2.22

### g_inet_socket_address_new_from_string ()

    GSocketAddress *
    g_inet_socket_address_new_from_string (const char *address,
                                           guint port);

Creates a new GInetSocketAddress for `address` and `port` .

If `address` is an IPv6 address, it can also contain a scope ID (separated from the address by a `%`).

#### Parameters

address | the string form of an IP address |
port | a port number |

#### Returns

a new GInetSocketAddress, or `NULL` if `address` cannot be parsed.

Since: 2.40

### g_inet_socket_address_get_address ()

    GInetAddress *
    g_inet_socket_address_get_address (GInetSocketAddress *address);

Gets `address` 's GInetAddress.

#### Parameters

address | a GInetSocketAddress |

#### Returns

the GInetAddress for `address` , which must be `g_object_ref()`'d if it will be stored.

[transfer none]

Since: 2.22

### g_inet_socket_address_get_port ()

    guint16
    g_inet_socket_address_get_port (GInetSocketAddress *address);

Gets `address` 's port.

#### Parameters

address | a GInetSocketAddress |

#### Returns

the port for `address`

Since: 2.22

### g_inet_socket_address_get_flowinfo ()

    guint32
    g_inet_socket_address_get_flowinfo (GInetSocketAddress *address);

Gets the `sin6_flowinfo` field from `address` , which must be an IPv6 address.

#### Parameters

address | a `G_SOCKET_FAMILY_IPV6` GInetSocketAddress |

#### Returns

the flowinfo field

Since: 2.32

### g_inet_socket_address_get_scope_id ()

    guint32
    g_inet_socket_address_get_scope_id (GInetSocketAddress *address);

Gets the `sin6_scope_id` field from `address` , which must be an IPv6 address.

#### Parameters

address | a `G_SOCKET_FAMILY_IPV6` GInetAddress |

#### Returns

the scope id field

Since: 2.32

## Types and Values

### GInetSocketAddress

    typedef struct _GInetSocketAddress GInetSocketAddress;

An IPv4 or IPv6 socket address, corresponding to a struct sockaddr_in or struct sockaddr_in6.

## Property Details

### The `“address”` property

      “address”                  GInetAddress *

The address.

Flags: Read / Write / Construct Only

### The `“flowinfo”` property

      “flowinfo”                 guint

The `sin6_flowinfo` field, for IPv6 addresses.

Flags: Read / Write / Construct Only

Default value: 0

Since: 2.32

### The `“port”` property

      “port”                     guint

The port.

Flags: Read / Write / Construct Only

Allowed values: <= 65535

Default value: 0

### The `“scope-id”` property

      “scope-id”                 guint

IPv6 scope ID.

Flags: Read / Write / Construct Only

Default value: 0