Gio.SocketAddress¶
class — extends GObject.Object, SocketConnectable
GSocketAddress is the equivalent of
struct sockaddr and its subtypes in the BSD sockets
API. This is an abstract class; use InetSocketAddress for
internet sockets, or UnixSocketAddress for UNIX domain sockets.
Constructors¶
new_from_native¶
Creates a SocketAddress subclass corresponding to the native
struct sockaddr native.
Parameters:
native— a pointer to a struct sockaddrlen— the size of the memory location pointed to bynative
Methods¶
get_family¶
Gets the socket family type of address.
get_native_size¶
Gets the size of address's native struct sockaddr.
You can use this to allocate memory to pass to
SocketAddress.to_native.
to_native¶
Converts a SocketAddress to a native struct sockaddr, which can
be passed to low-level functions like connect() or bind().
If not enough space is available, a IOErrorEnum.NO_SPACE error
is returned. If the address type is not known on the system
then a IOErrorEnum.NOT_SUPPORTED error is returned.
Parameters:
dest— a pointer to a memory location that will contain the native struct sockaddrdestlen— the size ofdest. Must be at least as large asSocketAddress.get_native_size
Virtual methods¶
do_get_family¶
Gets the socket family type of address.
do_get_native_size¶
Gets the size of address's native struct sockaddr.
You can use this to allocate memory to pass to
SocketAddress.to_native.
do_to_native¶
Converts a SocketAddress to a native struct sockaddr, which can
be passed to low-level functions like connect() or bind().
If not enough space is available, a IOErrorEnum.NO_SPACE error
is returned. If the address type is not known on the system
then a IOErrorEnum.NOT_SUPPORTED error is returned.
Parameters:
dest— a pointer to a memory location that will contain the native struct sockaddrdestlen— the size ofdest. Must be at least as large asSocketAddress.get_native_size
Properties¶
family¶
The family of the socket address.