Gio.SocketConnection

const Gio = imports.gi.Gio;

let socketConnection = new Gio.SocketConnection({
    socket: value,
});
  

Gio.SocketConnection is a Gio.IOStream for a connected socket. They can be created either by Gio.SocketClient when connecting to a host, or by Gio.SocketListener when accepting a new client.

The type of the Gio.SocketConnection 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 Gio.TcpConnection.

Choosing what type of object to construct is done with the socket connection factory, and it is possible for 3rd parties to register custom socket connection types for specific combination of socket family/type/protocol using Gio.SocketConnection.factory_register_type.

To close a Gio.SocketConnection, use Gio.IOStream.prototype.close. Closing both substreams of the Gio.IOStream separately will not close the underlying Gio.Socket.

Since 2.22

Hierarchy

  • GObject.Object
    • Gio.IOStream
      • Gio.SocketConnection