问题描述
这是我在这里的第一篇文章.我有一个嵌入式以太网 PIC32 uC,它在一个特定端口上将 UDP 包发送到我 PC 上的 C# 程序.使用 C# 我想按如下方式获取这个包:
this is my first post in here.I have an embedded Ethernet PIC32 uC that is sending UDP packages on one specific port to my C# Program on my PC.With C# i want to grab this packages as follows:
UdpClient udpClient = new UdpClient( 20011 );
IPEndPoint sender = new IPEndPoint(IPAddress.Any, 0);
while (true)
{
byte[] content = udpClient.Receive(ref sender);
}
一个包看起来像这样(wireshark):源:192.168.1.38 目标:192.168.1.44 协议:UDP 长度:122 源端口:1000 目标端口:20011
A package looks like this (wireshark):Source: 192.168.1.38 Destination: 192.168.1.44 Protocol: UDP Length: 122 Source port: 1000 Destination port: 20011
有趣的是,只要 wire-shark 软件在后台运行,一切都正常!一旦我停止收听wire-shark,就不会再收到c#中的包了.
The interesting part is, that everything works fine as long as the wire-shark software is running in background! As soon as I stop listening on wire-shark no more packages in c# where received.
有人知道这里发生了什么吗?
Does anyone has an idea what is happening here?
感谢您的回答克里斯
推荐答案
问题是客户端没有正确解析目标 MAC 地址.谢谢你的提示
The problem was that the destination MAC Address was not resolved by the client correctly.Thanks for your hints
这篇关于当wire-shark关闭时无法接收UDP包的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!