1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55
|
.TH LC_SOCKETPAIR 3 2024-04-08 "LIBRECAST" "Librecast Programmer's Manual"
.SH NAME
lc_socketpair \- create a pair of connected Librecast sockets
.SH LIBRARY
Librecast library
.RI ( liblibrecast ", " \-llibrecast )
.SH SYNOPSIS
.nf
.B #include <librecast/net.h>
.PP
.BI "int lc_socketpair(lc_ctx_t " *ctx ", lc_socket_t " *sock [2]);
.fi
.PP
Compile and link with \fI\-llibrecast\fP.
.SH DESCRIPTION
.BR lc_socketpair ()
creates a pair of connected Librecast sockets.
.PP
Call
.BR lc_socket_close (3)
when done.
Sockets can also be freed by a call to
.BR lc_ctx_free (3)
on the Librecast context which will free the context and all associated sockets and
channels.
.SH RETURN VALUE
On success, zero is returned. On error, -1 is returned,
.I errno
is set to indicate the error.
.SH ERRORS
.BR lc_socketpair ()
can fail with the following errors:
.TP
.B ENOMEM
Out of memory.
Possibly, the application hit the
.BR RLIMIT_AS
or
.BR RLIMIT_DATA
limit described in
.BR getrlimit (2).
.PP
.BR lc_socketpair ()
can also fail with any of the errors described in
.BR socketpair (2).
.PP
.SH SEE ALSO
.BR lc_socket_new (3),
.BR lc_channel_new (3),
.BR lc_ctx_new (3),
.BR lc_socket_setopt (3),
.BR setsockopt (2),
.BR socket (2),
.BR socketpair (2)
|