summaryrefslogtreecommitdiff
path: root/man/socket_tcp.3
diff options
context:
space:
mode:
authorJannis Hoffmann <jannis@fehcom.de>2024-07-09 13:02:45 +0200
committerJannis Hoffmann <jannis@fehcom.de>2024-07-09 13:02:45 +0200
commit96cf8dffe4f7b0b910f790066ae622dc429eb522 (patch)
treecc1343a0ac92bb4836cae2dd63a97fa045765e7f /man/socket_tcp.3
initial commit of version 23fehQlibs-23
Diffstat (limited to 'man/socket_tcp.3')
-rw-r--r--man/socket_tcp.358
1 files changed, 58 insertions, 0 deletions
diff --git a/man/socket_tcp.3 b/man/socket_tcp.3
new file mode 100644
index 0000000..3616ed7
--- /dev/null
+++ b/man/socket_tcp.3
@@ -0,0 +1,58 @@
+.TH qlibs: socket_tcp 3
+.SH NAME
+socket_tcp \- setting up TCP sockets
+.SH SYNTAX
+.B #include \(dqsocket_if.h\(dq
+
+int \fBsocket_tcp4\fP();
+.br
+int \fBsocket_tcp6\fP();
+.br
+int \fBsocket_tcp\fP();
+.SH DESCRIPTION
+.B socket_tcp4
+creates a non-blocking TCP/IPv4 stream socket and
+providing a file descriptor pointing to that socket.
+
+.B socket_tcp6
+creates a non-blocking TCP/IPv6 stream socket and
+providing a file descriptor pointing to that socket.
+
+.B socket_tcp
+creates a non-blocking IPv6 TCP/IP socket calling
+.B socket_tcp6
+unless it can't bind to IPv6 and now facilitating
+.BR socket_tcp4 .
+.SH "REMOTE CODES"
+All these routines return
+.IR 0
+except in case of failures, returning
+.I -1
+and setting
+.I errno
+appropriately, without allocating any resources.
+.SH EXAMPLE
+ #include <socket_if.h>
+
+ int \fIt\fR;
+ char \fIlocalip\fR[16];
+ char \fIremoteip\fR[16];
+ uint16 \fIp\fR;
+
+ if (ip6_isv4mapped(remoteip)) {
+ t = socket_tcp4();
+ socket_bind4(t,localip + 12,0);
+ } else {
+ t = socket_tcp6();
+ socket_bind6(t,localip,0,0);
+ }
+ socket_connect(s,remoteip,p,0);
+.SH "SEE ALSO"
+socket_if(3),
+socket_bind(3),
+socket_connect(3),
+socket_info(3),
+socket_recv(3),
+socket_send(3),
+socket_setup(3),
+socket_udp(3)