Posted on 2011-02-07 22:25
S.l.e!ep.¢% 阅读(734)
评论(1) 编辑 收藏 引用 所属分类:
Unix
//设置成SO_DOTLINGER的优雅关闭
struct linger liner;
liner.l_onoff = 0;
setsockopt(getSocket(), SOL_SOCKET,SO_LINGER,(char*)&liner,sizeof(liner));
shutdown(getSocket(),2);
SOCKET_CLOSE(getSocket());