UDP 套接字未与端口解除绑定

发布于 2025-01-15 18:03:33 字数 235 浏览 3 评论 0原文

我面临一个奇怪的问题,当我调用 closesocket() 时,之前绑定到端口的 UDP 套接字并未从该端口解除绑定。 API 调用不会返回任何错误,但 netstat 命令和 TCPView 应用程序仍然显示该端口仍在被我的应用程序使用。

我的应用程序是一个 COM 服务器,套接字创建发生在一个线程上,绑定关闭发生在不同线程上,在第三个线程上读取。

到目前为止,尝试在同一线程上创建套接字、绑定、读取和关闭,但仍然遇到问题。

I am facing a strange issue where my UDP socket that was earlier bound to a port is not unbinding from the port when I call closesocket(). The API call doesn't return any error but netstat command and TCPView app still show that port is still in use by my application.

My application is a COM server and socket creation happens on one thread, binding closing happens on different thread, reading on a third thread.

So far tried creating the socket, binding, reading and closing on the same thread but still seeing the issue.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文