Gio.Socket.prototype.send_to

function send_to(address: Gio.SocketAddress, buffer: ByteArray, cancellable: Gio.Cancellable): Number(gssize) {
    // Gjs wrapper for g_socket_send_to()
}
  

Tries to send size bytes from buffer to address. If address is null then the message is sent to the default receiver (set by Gio.Socket.prototype.connect).

See Gio.Socket.prototype.send for additional information.

Since 2.22

address

a Gio.SocketAddress, or null

buffer

the buffer containing the data to send.

cancellable

a %GCancellable or null

Returns

Number of bytes written (which may be less than size), or -1 on error