检查是否在C中发送UDP消息

发布于 2025-02-10 11:18:08 字数 151 浏览 1 评论 0原文

我想检查为什么程序未接收UDP消息。客户程序每次示例都会发送4个整数。我有一个使用“ recvFrom()”在端口上获取UDP消息的服务器程序,但是该程序似乎没有接收端口号上的消息,并且粘贴在“ recvFrom”函数中。我想知道我是否可以使用调试技术来调试此问题?

谢谢!

I want to check why a program is not receiving UDP messages. A client program is sending 4 integers every time sample. I have a server program that is using "recvfrom()" to get the UDP messages on a port but the program does not seem to be receiving the messages on the port number and is stuck in the "recvfrom" function. I was wondering if there are debugging techniques I can use to debug this issue?

Thanks!

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

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

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

小…楫夜泊 2025-02-17 11:18:08

有很多可能性,常见的情况可能是

  1. 您的机器或运输中的防火墙,例如,您的另一个端点是在防火墙后面禁止使用此地址的UDP入口流量。

  2. 路由,确保ping有效

  3. 您的代码错误,请确保循环back地址有效

调试,您可以安装Wireshark来检查特定接口的流量。

There are many possibilities, common case could be,

  1. Firewall on your machine or in transit, for example, your another endpoint is behind a firewall that disallow UDP inbound traffic from this address.

  2. Routing, make sure the ping works

  3. Your code bug, make sure loopback address works

To debug, you could install Wireshark to inspect specific interface's traffic.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文