Reputation: 89
Has anyone succeded to use TCP Fast Open Option on Android?
I use this code inside an Android NDK C program:
sfd = socket(AF_INET, SOCK_STREAM, 0);
sendto(sfd, data, data_len, MSG_FASTOPEN, (struct sockaddr *) &server_addr, addr_len);
as suggested at http://lwn.net/Articles/508865/
It compiles fine both on Linux and Android.
It works flawlessy on Linux but on Android when it calls sendto() the program exits.
I tried it on Android 4.* and 5.1 (devices) and even on Android 6 (emulator only for now).
PS
I noticed that on Android 4.* at /proc/sys/net/ipv4/
there's no tcp_fastopen
file, on Android 5.1 the file is there but it contains 0.
Upvotes: 2
Views: 1803
Reputation: 2180
TCP fast open requires Linux kernel 3.7+. Check the kernel version first.
Here's a sheet of kernel versions in AOSP. Note that it might to represent the real kernel version on your device.
If it's supported, you need to enable it using echo 3 > /proc/sys/net/ipv4/tcp_fastopen
. It requires root permission.
Upvotes: 2