Method

GioSocketAddressto_native

since: 2.22

Declaration

gboolean
g_socket_address_to_native (
  GSocketAddress* address,
  gpointer dest,
  gsize destlen,
  GError** error
)

Description

Converts a GSocketAddress to a native struct sockaddr, which can be passed to low-level functions like connect() or bind().

If not enough space is available, a G_IO_ERROR_NO_SPACE error is returned. If the address type is not known on the system then a G_IO_ERROR_NOT_SUPPORTED error is returned.

Available since: 2.22

Parameters

dest

Type: gpointer

A pointer to a memory location that will contain the native struct sockaddr.

The argument can be NULL.
The data is owned by the caller of the function.
destlen

Type: gsize

The size of dest. Must be at least as large as g_socket_address_get_native_size()

error

Type: GError **

The return location for a recoverable error.

The argument can be NULL.
If the return location is not NULL, then you must initialize it to a NULL GError*.
The argument will left initialized to NULL by the method if there are no errors.
In case of error, the argument will be set to a newly allocated GError; the caller will take ownership of the data, and be responsible for freeing it.

Return value

Type: gboolean

TRUE if dest was filled in, FALSE on error.