如何中止“关闭”TCP连接?
答
如果我记得,您设置SO_LINGER选项。
struct linger l;
l.l_onoff = 1;
l.l_linger = 0;
setsockopt(sock, SOL_SOCKET, SO_LINGER, &l, sizeof(l));