1.78 <GSocketAddress>

Class: <GSocketAddress>

It derives from <GObject>.

<GSocketAddress> is the equivalent of ‘struct sockaddr‘) and its subtypes in the BSD sockets API. This is an abstract class; use <GInetSocketAddress> for internet sockets, or <GUnixSocketAddress> for UNIX domain sockets.

Fields

parent-instance

Properties

Property: socket-address:family self

The family of the socket address.

Its value is a <GSocketFamily>.

It is read only.

Procedures

Method: socket-address:get-family self ⇒ %return
Method: get-family self ⇒ %return

Gets the socket family type of self.

self

Passed: a <GSocketAddress>.

a <GSocketAddress>

%return

Returned: a <GSocketFamily>.

the socket family type of self

Method: socket-address:get-native-size self ⇒ %return
Method: get-native-size self ⇒ %return

Gets the size of self’s native struct sockaddr. You can use this to allocate memory to pass to socket-address:to-native?.

self

Passed: a <GSocketAddress>.

a <GSocketAddress>

%return

Returned: a 64-bit integer.

the size of the native struct sockaddr that self represents, or -1 if self is not valid

Procedure: socket-address:new-from-native native len ⇒ %return

Creates a <GSocketAddress> subclass corresponding to the native struct sockaddr native.

native

Passed: a foreign pointer, or a bytevector.

a pointer to a struct sockaddr

len

Passed: an unsigned 64-bit integer.

the size of the memory location pointed to by native

%return

Returned: a <GSocketAddress>.

a new <GSocketAddress> if native could successfully be converted, otherwise #f

Method: socket-address:to-native? self dest destlen ⇒ %return
Method: to-native? self dest destlen ⇒ %return

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 no-space error is returned. If the address type is not known on the system then a not-supported error is returned.

self

Passed: a <GSocketAddress>.

a <GSocketAddress>

dest

Passed: a foreign pointer, or a bytevector, or #f.

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

destlen

Passed: an unsigned 64-bit integer.

the size of dest. Must be at least as large as socket-address:get-native-size

%return

Returned: a boolean.

#t if dest was filled in, #f on error

Virtual methods

Virtual method: socket-address:do-get-family implementor self ⇒ %return

Gets the socket family type of self.

To override it in a new class, give register-type #:vfuncs `((get-family . ,procedure)). The procedure is called as (procedure self) ⇒ %return.

implementor

Passed: the class whose implementation to call: <GSocketAddress>, or a class that derives from it, or its GType number.

self

Passed: a <GSocketAddress>.

a <GSocketAddress>

%return

Returned: a <GSocketFamily>.

the socket family type of self

Virtual method: socket-address:do-get-native-size implementor self ⇒ %return

Gets the size of self’s native struct sockaddr. You can use this to allocate memory to pass to socket-address:to-native?.

To override it in a new class, give register-type #:vfuncs `((get-native-size . ,procedure)). The procedure is called as (procedure self) ⇒ %return.

implementor

Passed: the class whose implementation to call: <GSocketAddress>, or a class that derives from it, or its GType number.

self

Passed: a <GSocketAddress>.

a <GSocketAddress>

%return

Returned: a 64-bit integer.

the size of the native struct sockaddr that self represents, or -1 if self is not valid

Virtual method: socket-address:do-to-native implementor self dest destlen ⇒ %return

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 no-space error is returned. If the address type is not known on the system then a not-supported error is returned.

To override it in a new class, give register-type #:vfuncs `((to-native . ,procedure)). The procedure is called as (procedure self dest destlen) ⇒ %return.

implementor

Passed: the class whose implementation to call: <GSocketAddress>, or a class that derives from it, or its GType number.

self

Passed: a <GSocketAddress>.

a <GSocketAddress>

dest

Passed: a foreign pointer, or a bytevector, or #f.

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

destlen

Passed: an unsigned 64-bit integer.

the size of dest. Must be at least as large as socket-address:get-native-size

%return

Returned: a boolean.

#t if dest was filled in, #f on error