I'm trying to port some code over to OSX - it appears that setsockopt
has a few differences from Linux. The one I've found and corrected so far is using TCP_KEEPALIVE instead of TCP_KEEPIDLE.
What is the equivalent to TCP_USER_TIMEOUT for OSX?
Using TCP_USER_TIMEOUT fails to compile and prints an undeclared identifier
error
I find a macro named "TCP_CONNECTIONTIMEOUT" in tcp.h. I use it to replace TCP_USER_TIMEOUT on Mac. It works well. You may try it.