Gio.Socket.prototype.set_option

function set_option(level: Number(gint), optname: Number(gint), value: Number(gint)): Boolean {
    // Gjs wrapper for g_socket_set_option()
}
  

Sets the value of an integer-valued option on socket, as with setsockopt(). (If you need to set a non-integer-valued option, you will need to call setsockopt() directly.)

The [<gio/gnetworking.h>][gio-gnetworking.h] header pulls in system headers that will define most of the standard/portable socket options. For unusual socket protocols or platform-dependent options, you may need to include additional headers.

Since 2.36

level

the "API level" of the option (eg, `SOL_SOCKET`)

optname

the "name" of the option (eg, `SO_BROADCAST`)

value

the value to set the option to

Returns

success or failure. On failure, @error will be set, and the system error value (`errno` or WSAGetLastError()) will still be set to the result of the setsockopt() call.