Socket
Creates a new #GSocket with the defined family, type and protocol. If @protocol is 0 (%G_SOCKET_PROTOCOL_DEFAULT) the default protocol type for the family and type is used.
The @protocol is a family and type specific int that specifies what kind of protocol to use. #GSocketProtocol lists several common ones. Many families only support one protocol, and use 0 for this, others support several and using 0 means to use the default protocol for the family and type.
The protocol id is passed directly to the operating system, so you can use protocols not listed in #GSocketProtocol if you know the protocol number used for it.
Return
a #GSocket or null on error. Free the returned object with g_object_unref().
Since
2.22
Parameters
the socket family to use, e.g. %G_SOCKET_FAMILY_IPV4.
the socket type to use.
the id of the protocol to use, or 0 for default.
Creates a new #GSocket from a native file descriptor or winsock SOCKET handle.
This reads all the settings from the file descriptor so that all properties should work. Note that the file descriptor will be set to non-blocking mode, independent on the blocking mode of the #GSocket.
On success, the returned #GSocket takes ownership of @fd. On failure, the caller must close @fd themselves.
Since GLib 2.46, it is no longer a fatal error to call this on a non-socket descriptor. Instead, a GError will be set with code %G_IO_ERROR_FAILED
Return
a #GSocket or null on error. Free the returned object with g_object_unref().
Since
2.22
Parameters
a native socket file descriptor.