2010-03-02 13:41 | Posted by Sunshow | Filed Under C, Network
调用libcurl下载,然后使用netstat查看发现有大量的TCP连接保持在CLOSE_WAIT状态
查看libcurl的文档说明,有这样一个选项:
CURLOPT_FORBID_REUSE
Pass a long. Set to 1 to make the next transfer explicitly close the connection when done. Normally, libcurl keeps all connections alive when done with one transfer in case a succeeding one follows that can re-use them. This option should be used with caution and only if you understand what it does. Set to 0 to have libcurl keep the connection open for possible later re-use (default behavior).
也就是说,默认情况下libcurl完成一个任务以后,出于重用连接的考虑不会马上关闭
如果没有新的TCP请求来重用这个连接,那么只能等到CLOSE_WAIT超时,这个时间默认在7200秒甚至更高,太多的CLOSE_WAIT连接会导致性能问题
解决方法:
curl_easy_setopt(curl, CURLOPT_FORBID_REUSE, 1);
最好再修改一下TCP参数调低CLOSE_WAIT和TIME_WAIT的超时时间
标签:
libcurl,
TCP,
下载
相关日志
2010-01-06 22:36 | Posted by Sunshow | Filed Under Network
从万网转出果然是名不虚传的困难
其中的艰辛不再赘述,劝君莫用万网
还有另一个域名还在继续跟万网作斗争
PS: 发表完了看到相关日志,顿时泪流满面!
标签:
GoDaddy,
万网,
域名
相关日志
2009-07-01 10:21 | Posted by Sunshow | Filed Under Life, Network
看图不说话……



这个速度,泪奔啊……
回家再试试
标签:
3G,
EVDO,
上地,
速度
相关日志
2009-06-29 15:31 | Posted by Sunshow | Filed Under Linux, Network
curl -H "Expect:" -F "action=upload_mf.php" -F "file=@1246285971.xml;type=text/xml" http://localhost/upload_mf.php
加上"Expect:"的Header是因为Curl会默认带上"Expect: 100-continue",而我用的lighttpd 1.4.18不支持这个Header,会返回417的状态码导致出错
标签:
curl,
lighttpd,
上传,
文件
相关日志
2009-04-15 07:49 | Posted by Sunshow | Filed Under Network
按照《中国互联网络域名管理办法》以及国家相关部门提出的“域名注册信息要做到真实、准确、完整”的要求,万网对域名注册信息进行了抽查工作,我们发现您的域名 sunshow.net 注册信息中 注册人地址:Beijing , 管理联系人地址:Beijing 项涉及“不真实、不准确、不完整”。
再想到之前的TGBUS事件,我们的网络已经越来越健康了
标签:
中国,
互联网,
域名,
控制
相关日志
Recent Comments