SocketAddress#
Superclasses: Object
Subclasses: InetSocketAddress
, NativeSocketAddress
, UnixSocketAddress
Implemented Interfaces: SocketConnectable
GSocketAddress
is the equivalent of
`struct sockaddr
<man:sockaddr(3type)>`__ 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#
- class SocketAddress
- classmethod new_from_native(native: Any, len: int) SocketAddress #
Creates a
SocketAddress
subclass corresponding to the native struct sockaddrnative
.Added in version 2.22.
- Parameters:
native – a pointer to a struct sockaddr
len – the size of the memory location pointed to by
native
Methods#
- class SocketAddress
- do_get_family(self) SocketFamily #
- get_family() SocketFamily #
Gets the socket family type of
address
.Added in version 2.22.
- get_native_size() int #
Gets the size of
address
's native struct sockaddr. You can use this to allocate memory to pass toto_native()
.Added in version 2.22.
- to_native(dest: Any, destlen: int) bool #
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
NO_SPACE
error is returned. If the address type is not known on the system then aNOT_SUPPORTED
error is returned.Added in version 2.22.
- Parameters:
dest – a pointer to a memory location that will contain the native struct sockaddr
destlen – the size of
dest
. Must be at least as large asget_native_size()
Properties#
- class SocketAddress
- props.family: SocketFamily#
The type of the None singleton.
Added in version 2.22.
Virtual Methods#
- class SocketAddress
- do_get_family() SocketFamily #
Gets the socket family type of
address
.Added in version 2.22.
- do_get_native_size() int #
Gets the size of
address
's native struct sockaddr. You can use this to allocate memory to pass toto_native()
.Added in version 2.22.
- do_to_native(dest: Any, destlen: int) bool #
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
NO_SPACE
error is returned. If the address type is not known on the system then aNOT_SUPPORTED
error is returned.Added in version 2.22.
- Parameters:
dest – a pointer to a memory location that will contain the native struct sockaddr
destlen – the size of
dest
. Must be at least as large asget_native_size()
Fields#
- class SocketAddress
- parent_instance#