Socket 连线报错iResult=[10055] TCP : No Buffer space available

1.问题
windows sever 2019 系统环境下, 从服务器到设备IP IP ping得通,但是连线失败,一直提示报 No Buffer space available。
2.可以用指令进行输入查询cmd输入
netstat -an 发现有大量处于TIME_WAIT状态的TCP链接(socket未释放)
*实践得到的原因发现:存在网络通-断讯-通-断讯,这种间歇断讯情况的时候
在这里插入图片描述
3.解决方案
方案1:关机重启(亲测,有效果,非长久之计)
方案2:查询 →修改→再查询 (亲测,有效果),修改端口会引起3秒的断网情况,不必重启服务器就可以自动恢复~
微软官网说明文件,修改注册表内容

https://docs.microsoft.com/zh-CN/troubleshoot/windows-client/networking/connect-tcp-greater-than-5000-error-wsaenobufs-10055

在这里插入图片描述

方案3:微软打补丁,X64系统存在BUG,特别是微软2008 及WIN7 系统,官网有特别说明及可以质询您的供应商。

sockets-leak-on-a-multiprocessor-computer-that-is-running-windows-server-2008-r2-or-windows-7-00056888-7637-2df7-e673-e60f16745e0e

在这里插入图片描述

在这里插入图片描述

方案4:回收已无法链接的端口!!!找时间测试

  • 2
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
可以尝试将代码中的WSAQUERYSET result改为LPWSAQUERYSET result,即使用指向WSAQUERYSET结构体的指针类型,代码如下: int main() { std::map<std::string, std::string> config = readIniFile("config.ini"); int bluetoothCount = std::stoi(config["bluetooth.count"]); std::string logFileName = config["log.filename"]; WSADATA wsaData; int iResult = WSAStartup(MAKEWORD(2, 2), &wsaData); if (iResult != 0) { std::cout << "WSAStartup failed: " << iResult << std::endl; return 1; } WSAQUERYSET service; memset(&service, 0, sizeof(service)); service.dwSize = sizeof(service); service.dwNameSpace = NS_BTH; HANDLE lookupHandle = NULL; iResult = WSALookupServiceBegin(&service, LUP_CONTAINERS, &lookupHandle); if (iResult != 0) { std::cout << "WSALookupServiceBegin failed: " << iResult << std::endl; WSACleanup(); return 1; } int count = 0; while (count < bluetoothCount) { WSAQUERYSET* result; memset(&result, 0, sizeof(result)); result->dwSize = sizeof(WSAQUERYSET); iResult = WSALookupServiceNext(lookupHandle, LUP_RETURN_NAME | LUP_RETURN_ADDR, result); if (iResult != 0) { break; } count++; } WSALookupServiceEnd(lookupHandle); WSACleanup(); if (count >= bluetoothCount) { std::string logText = "Bluetooth count is " + std::to_string(count) + ", reached the target count of " + std::to_string(bluetoothCount); writeLogFile(logFileName, logText); } else { std::string logText = "Bluetooth count is " + std::to_string(count) + ", did not reach the target count of " + std::to_string(bluetoothCount); writeLogFile(logFileName, logText); } return 0; }

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值