struct linger zerolinger;
int nSendTimeout = 6000;
bool result=false; SOCKET send_socket = ::socket(AF_INET,SOCK_DGRAM,IPPROTO_UDP);
if (send_socket<0)
{
//创建socket失败
return;
} //设置socket属性
zerolinger.l_onoff = 1;
zerolinger.l_linger = 5;
setsockopt(send_socket,SOL_SOCKET,SO_LINGER,(const char *)&zerolinger,sizeof(zerolinger)); setsockopt(send_socket,SOL_SOCKET,SO_SNDTIMEO,(const char *)&nSendTimeout,sizeof(nSendTimeout));
解决方案 »
- 有谁编译过tightvnc2.0?
- bento4,写MP4文件时,遇到的困难。
- fatal error C1001: INTERNAL COMPILER ERROR错误问题
- sock http接收有问题
- 关于按纽图片动态显示
- 当设置了Owner draw属性时,按键响应速度为什么这么迟钝???
- 求VC 代理服务器代码
- 这里人气比较旺,机子中了木马之类的,就是进去了那个888bbb.com中的,发QQ信息时总加了些其他信息,而且把我的IE首页也改了,高手帮帮忙.
- 大家来看看这几个api怎么用?
- 如何避免WebBrowser中body.style.zoom功能放大滚动条
- 无法捕捉异常:First-chance exception
- IconWorkShop 怎么生成MFC序列图 求简单易学方法
SO_LINGER: The linger structure maintains information about a specific socket that specifies how that socket should behave when data is queued to be sent and the closesocket function is called on the socket.SO_SNDTIMEO:Sends time-out in milliseconds (available in the Microsoft implementation of Windows Sockets 2).