Reputation: 14975
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
Upvotes: 1
Views: 2525
Reputation: 159
Another possible option is TCP_RXT_CONNDROPTIME
from the same header:
#define TCP_RXT_CONNDROPTIME 0x80 /* time after which tcp retransmissions will be
* stopped and the connection will be dropped
*/
I've found this weird commit where there are three implementations provided for TCP_USER_TIMEOUT
:
TCP_USER_TIMEOUT
is set manually (seems like this code is quite outdated);TCP_RXT_CONNDROPTIME
is used;This commit might be a clue, but I haven't tested it myself. I just hope that this information could be helpful to someone.
Check TCP_USER_TIMEOUT
and TCP_CONNECTIONTIMEOUT
descriptions in the Linux man and BSD man - they doesn't seem to be very similar.
Upvotes: 1
Reputation: 46
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.
Upvotes: 3