[ CCode ( has_construct_function = false ) ]
public Socket (SocketFamily family, SocketType type, SocketProtocol protocol) throws Error

Creates a new Socket 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. SocketProtocol 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 SocketProtocol if you know the protocol number used for it.



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.


a Socket or null on error. Free the returned object with unref.