UnixSocketAddress.with_type


Description:

[ CCode ( has_construct_function = false , type = "GSocketAddress*" ) ]
public UnixSocketAddress.with_type (string path, int path_len, UnixSocketAddressType type)

Creates a new UnixSocketAddress of type type with name path.

If type is g_unix_socket_address_path, this is equivalent to calling UnixSocketAddress.

If type is g_unix_socket_address_anonymous, path and path.length will be ignored.

If path_type is g_unix_socket_address_abstract, then path.length bytes of path will be copied to the socket's path, and only those bytes will be considered part of the name. (If path.length is -1, then path is assumed to be NUL-terminated.) For example, if path was "test", then calling get_native_size on the returned socket would return 7 (2 bytes of overhead, 1 byte for the abstract-socket indicator byte, and 4 bytes for the name "test").

If path_type is g_unix_socket_address_abstract_padded, then path.length bytes of path will be copied to the socket's path, the rest of the path will be padded with 0 bytes, and the entire zero-padded buffer will be considered the name. (As above, if path.length is -1, then path is assumed to be NUL-terminated.) In this case, get_native_size will always return the full size of a `struct sockaddr_un`, although get_path_len will still return just the length of path.

g_unix_socket_address_abstract is preferred over g_unix_socket_address_abstract_padded for new programs. Of course, when connecting to a server created by another process, you must use the appropriate type corresponding to how that process created its listening socket.

Parameters:

path

the name

type

a UnixSocketAddressType

path_len

the length of path, or -1

Returns:

a new UnixSocketAddress