I am writing a TCP client on a Linux 3.15 machine that can use TCP Fast Open:
status = sendto(sd, (const void *) data, data_len, MSG_FASTOPEN, (const struct sockaddr *) hostref->ai_addr, sizeof(struct sockaddr_in)); if (status < 0) { fprintf(stderr, "sendto: %s\n", strerror(errno)); exit(EXIT_FAILURE); } fprintf(stdout, "TFO connection successful to %s\n", text_of(hostref->ai_addr));
Using tcpdump, I can check the sending of the TCP Fast Open option and bypass the three-way handshake (tested with Google servers).
However, with servers that do not support TCP quick open, sendto still succeeds and the message "TFO connection successful" is displayed. Linux kernel code seems to revert to normal TCP if the server does not support TCP Fast Open (again, checked with tcpdump).
How do I know if my TCP Fast Open connection is used or not?
source share