You can clone with
HTTPS or Subversion.
Windows: the correct way to make TCP_KEEPALIVE work on MinGW
Would you mind point me to the right MSDN documentation of TCP_KEEPALIVE? I've tried find any reference to it on MSDN without success, only SO_KEEPALIVE exists.
When run tests with SO_KEEPALIVE nothing failed, so I assumed was correct, seems I was not :-(
Will be great to bring these missing definitions back to mingw and mingw-w64 projects.
Calling setsockopt with IPPROTO_TCP and TCP_KEEPALIVE on Windows does not setting keep-alive timeout.
it just enable or disalbe TCP keep-alive option.
To set the keep-alive timeout, you must call WSAIoctl with SIO_KEEPALIVE_VALS and tcp_keepalive struncture.
Refer to http://msdn.microsoft.com/en-us/library/windows/desktop/dd877220(v=vs.85).aspx
Actually, IPPROTO_TCP + TCP_KEEPALIVE does map to SIO_KEEPALIVE_VALS + tcp_keepalive.keepalivetime (for API compatibility). You can try setting keep-alive delay through WSAIoctl, and then read it with getsockopt(IPPROTO_TCP,TCP_KEEPALIVE). But yeah we should use winsock WSAIoctl function instead as recommended by MSDN.