.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 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)