It derives from <GIOStream>.
<GSocketConnection> is a
<GIOStream> for a connected socket. They can be
created either by <GSocketClient> when
connecting to a host, or by
<GSocketListener> when accepting a new
client.
The type of the <GSocketConnection>
object returned from these calls depends on the type of the underlying
socket that is in use. For instance, for a TCP/IP connection it will be
a <GTcpConnection>.
Choosing what type of object to construct is done with the socket
connection factory, and it is possible for third parties to register
custom socket connection types for specific combination of socket
family/type/protocol using socket-connection:factory-register-type.
To close a <GSocketConnection>, use
iostream:close?. Closing both substreams
of the <GIOStream> separately will not close the
underlying <GSocket>.
parent-instanceprivThe underlying <GSocket>.
Its value is a <GSocket>, or #f.
It can only be set when the object is made, with #:socket.
Asynchronously connect self to the specified remote address.
This clears the socket:blocking
flag on self’s underlying socket if it is currently set.
If socket:timeout is set, the
operation will time out and return timed-out
after that period. Otherwise, it will continue indefinitely until
operating system timeouts (if any) are hit.
Use socket-connection:connect-finish? to retrieve the
result.
Passed: a <GSocketConnection>.
Passed: a <GSocketAddress>.
a <GSocketAddress> specifying the remote
address.
Passed, or left out: a <GCancellable>, or
#f.
a <GCancellable> or #f
Passed, or left out: a procedure, or #f.
See GAsyncReadyCallback for how it is
called.
Not passed: guile-gi supplies it.
user data for the callback
Gets the result of a socket-connection:connect-async call.
Passed: a <GSocketConnection>.
Passed: a <GAsyncResult>.
the <GAsyncResult>
Returned: a boolean.
#t if the connection succeeded, #f on error
Connect self to the specified remote address.
Passed: a <GSocketConnection>.
Passed: a <GSocketAddress>.
a <GSocketAddress> specifying the remote
address.
Passed, or left out: a <GCancellable>, or
#f.
a <GCancellable> or #f
Returned: a boolean.
#t if the connection succeeded, #f on error
Looks up the GType to be used when creating socket connections on
sockets with the specified family, type and
protocol-id.
If no type is registered, the
<GSocketConnection> base type is
returned.
Passed: a <GSocketFamily>, or one of its
symbols.
Passed: a <GSocketType>, or one of its symbols.
Passed: a 32-bit integer.
a protocol id
Returned: a class, or a GType number.
a GType
Looks up the GType to be used when creating socket connections on
sockets with the specified family, type and protocol.
If no type is registered, the
<GSocketConnection> base type is
returned.
Passed: a class, or a GType number.
a GType, inheriting from G_TYPE_SOCKET_CONNECTION
Passed: a <GSocketFamily>, or one of its
symbols.
Passed: a <GSocketType>, or one of its symbols.
Passed: a 32-bit integer.
a protocol id
Try to get the local address of a socket connection.
Passed: a <GSocketConnection>.
Returned: a <GSocketAddress>.
a <GSocketAddress> or #f on error.
Free the returned object with object:unref.
Try to get the remote address of a socket connection.
Since GLib 2.40, when used with socket-client:connect or socket-client:connect-async, during emission of
connecting, this function will return
the remote address that will be used for the connection. This allows
applications to print e.g. "Connecting to example.com (10.42.77.3)...".
Passed: a <GSocketConnection>.
Returned: a <GSocketAddress>.
a <GSocketAddress> or #f on error.
Free the returned object with object:unref.
Gets the underlying <GSocket> object of the
connection. This can be useful if you want to do something unusual on
it not supported by the
<GSocketConnection> APIs.
Passed: a <GSocketConnection>.
Returned: a <GSocket>.
a <GSocket> or #f on error.
Checks if self is connected. This is equivalent to calling
socket:is-connected? on self’s
underlying <GSocket>.
Passed: a <GSocketConnection>.
Returned: a boolean.
whether self is connected