1socket_fastopen_connect6(3)Library Functions Manualsocket_fastopen_connect6(3)
2
3
4

NAME

6       socket_fastopen_connect6 - make a TCP connection and send some data
7

SYNTAX

9       #include <socket.h>
10
11       ssize_t socket_fastopen_connect6(int s,
12                        const char ip[16],uint16 port,uint32 scope_id,
13                        const char* buf,size_t len);
14

DESCRIPTION

16       socket_fastopen_connect6  attempts to make a connection from TCP socket
17       s to TCP port port on IP address ip.  If that succeeds, it attempts  to
18       send len bytes from buf.
19
20       The difference to calling socket_connect6 followed by write is that, on
21       platforms supporting TCP Fast Open, socket_fastopen_connect6 will  send
22       the  first data packet in the third packet of the TCP handshake, saving
23       one useless ACK packet in network traffic.
24
25       This is only useful for protocols where  the  client  sends  the  first
26       bytes.
27
28       socket_connect6 may return
29
30
31       ·      >=0,  to  indicate  that  the connection succeeded and this many
32              bytes were sent.
33
34       ·      -1, setting errno to error_inprogress  or  error_wouldblock,  to
35              indicate that the socket is non-blocking
36
37       ·      -1,  setting  errno to something else, to indicate that the con‐
38              nection failed (and failed immediately, if the  socket  is  non-
39              blocking).
40
41       When a background connection succeeds or fails, s becomes writable; you
42       can use socket_connected to see whether the connection  succeeded.   If
43       the connection failed, socket_connected returns 0, setting errno appro‐
44       priately.
45
46       Once a TCP socket is connected, you can use the read and  write  system
47       calls to transmit data.
48
49       You  can  call  socket_connect6 without calling socket_bind6.  This has
50       the effect as first calling socket_bind6 with IP address :: and port 0.
51
52

EXAMPLE

54         #include <socket.h>
55
56         int s;
57         char ip[16];
58         uint16 p;
59         uint32 scope_id;
60
61         s = socket_tcp6b();
62         socket_bind6(s,ip,p);
63         socket_fastopen_connect6(s,ip,p,scope_id,"hello",5);
64
65

SEE ALSO

67       socket_connect6(3), socket_fastopen_connect4(3), socket_fastopen(3)
68
69
70
71                                                   socket_fastopen_connect6(3)
Impressum