Constructor
GioSocketnew
since: 2.22
Declaration [src]
GSocket*
g_socket_new (
GSocketFamily family,
GSocketType type,
GSocketProtocol protocol,
GError** error
)
Description [src]
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.
Available since: 2.22
Parameters
family
-
Type:
GSocketFamily
The socket family to use, e.g.
G_SOCKET_FAMILY_IPV4
. type
-
Type:
GSocketType
The socket type to use.
protocol
-
Type:
GSocketProtocol
The id of the protocol to use, or 0 for default.
error
-
Type:
GError **
The return location for a recoverable error.
The argument can be NULL
.If the return location is not NULL
, then you must initialize it to aNULL
GError*
.The argument will be left initialized to NULL
by the constructor if there are no errors.In case of error, the argument will be set to a newly allocated GError
; the caller will take ownership of the data, and be responsible for freeing it.
Return value
Type: GSocket
A GSocket
or NULL
on error.
Free the returned object with g_object_unref().
The caller of the function takes ownership of the data, and is responsible for freeing it. |