Feature: Implement initial macOS SimpleRemoter client

This commit is contained in:
yuanyuanxiang
2026-04-29 23:25:32 +02:00
parent 7a90d217f3
commit f2a184e760
23 changed files with 2958 additions and 21 deletions

View File

@@ -61,6 +61,10 @@ BOOL SetKeepAliveOptions(int socket, int nKeepAliveSec = 180)
return FALSE;
}
#ifdef __APPLE__
// macOS: 只有 TCP_KEEPALIVE (等同于 TCP_KEEPIDLE)
setsockopt(socket, IPPROTO_TCP, TCP_KEEPALIVE, &nKeepAliveSec, sizeof(nKeepAliveSec));
#else
// 设置 TCP_KEEPIDLE (3分钟空闲后开始发送 keep-alive 包)
if (setsockopt(socket, IPPROTO_TCP, TCP_KEEPIDLE, &nKeepAliveSec, sizeof(nKeepAliveSec)) < 0) {
Mprintf("Failed to set TCP_KEEPIDLE\n");
@@ -80,6 +84,7 @@ BOOL SetKeepAliveOptions(int socket, int nKeepAliveSec = 180)
Mprintf("Failed to set TCP_KEEPCNT\n");
return FALSE;
}
#endif
Mprintf("TCP keep-alive settings applied successfully\n");
return TRUE;