can't receive UDP packages when wire-shark is off

烈酒焚心 提交于 2019-12-11 01:49:35

问题


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);
        }

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

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?

Thanks for your answers Chris


回答1:


The problem was that the destination MAC Address was not resolved by the client correctly. Thanks for your hints




回答2:


Do you have an entry in the Windows Firewall? Does it work if you disable Windows Firewall temporarily?




回答3:


Is your machine really 192.168.1.44 ? If not, you are seeing the packets because wireshark puts the infterface in "promiscous" mode while it's running; if it resets the interface to normal mode, you don't see them anymore.



来源:https://stackoverflow.com/questions/15599982/cant-receive-udp-packages-when-wire-shark-is-off

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!