title: How to configure TCP_KEEPALIVE under MAC OS X
body: <p>Currently I've encountered this problem: how to detect unpredictable connection broken.</p>
  
  <p>I utilized SO_KEEPALIVE,TCP_KEEPIDLE,TCP_KEEPINTVL and TCP_KEEPCNT to solve it under linux, which seems working fine now.</p>
  
  <p>However,  It really took me a long time to find out how to work it out under MAC OS X. Somebody suggested me to turn to netinet/tcp_var.h, but still none of the aforementioned MACRO was found.</p>
  
  <p>So, my question is,</p>
  
  <p>How to implementation TCP KEEPALIVE under MAC OS X?</p>
  
  <p>P.S.: my MAC OS X version is 10.8.3,and my gcc/g++ version is 4.2.1</p>
  
  <p>Any reply would be appreciated. </p>