About this question
Medium · networking · Quant Developer interview question · tcp, keepalive, networking, socket-options, connection-management, hft-session
In low-latency trading, quickly detecting a dead exchange connection is critical for minimizing downtime and risk. TCP keep-alive parameters (TCP_KEEPIDLE, TCP_KEEPINTVL, TCP_KEEPCNT) are tuned to control this detection deadline. Calculating the worst-case time to declare a connection dead is essential for designing resilient trading systems. Task Implement the function compute_keepalive_deadline(int keepidle, int keepintvl, int keepcnt) to calculate the worst-case time in seconds for TCP to de