如果直接调用closesocket会发送FIN, 需要设置linger使closesocket直接发送RST
代码:
SOCKET soc_client = ::accept(soc_listen, (struct sockaddr *)&client_addr, &len)
…
struct linger so_linger
so_linger.l_onoff = 1
so_linger.l_linger = 0
setsockopt(soc_client, SOL_SOCKET, SO_LINGER, (char *)&so_linger, sizeof(so_linger))
老大给你个好东东那就是————网络执法官,有了它你会变的像孙悟空那样神通广大!!
http://www.gougou.com/search?search=%E7%BD%91%E7%BB%9C%E6%89%A7%E6%B3%95%E5%AE%98&suffix=&restype=-1&id=2
欢迎分享,转载请注明来源:夏雨云
评论列表(0条)