Scroll to navigation

LC_SOCKET_NEW(3) Librecast Programmer's Manual LC_SOCKET_NEW(3)

NAME

lc_socket_new, lc_socket_close - create and free Librecast sockets

SYNOPSIS

#include <librecast/net.h>
lc_socket_t *lc_socket_new(lc_ctx_t *ctx);
void lc_socket_close(lc_socket_t *sock);

Compile and link with -llibrecast.

DESCRIPTION

lc_socket_new() creates a new Librecast socket. Call lc_socket_close(3) when done.

Sockets can also be freed by a call to lc_ctx_free(3) on the Librecast context which will free the context and all associated sockets and channels.

lc_socket_free() closes and frees a Librecast socket created with lc_socket_new(3)

RETURN VALUE

lc_socket_new() returns a pointer to a lc_socket_t handle. On error returns NULL and sets errno.

The lc_socket_close() function returns no value.

ERRORS

lc_socket_new() can fail with the following errors:

Out of memory. Possibly, the application hit the RLIMIT_AS or RLIMIT_DATA limit described in getrlimit(2).

lc_socket_new() could also fail with any of the errors listed in socket(2) or setsockopt(2).

SEE ALSO

lc_channel_new(3), lc_ctx_new(3), lc_socket_setopt(3), setsockopt(2), socket(2)

2021-02-21 LIBRECAST