.net - Why is my UDPClient deaf to incoming UDP packets over the wifi interface? -


i have udpclient listener running on windows 7 machine. if bind local ip of wired ethernet adapter follows i'm able receive udp data without problems:

ipaddress^ localip = ipaddress::parse("10.10.7.76"); ipendpoint^ ep = gcnew ipendpoint(localip, 10002); udpclient^ udpclient = gcnew udpclient(ep); 

if bind wifi adapter , disable wired connection nothing:

ipaddress^ localip = ipaddress::parse("192.168.1.2"); ipendpoint^ ep = gcnew ipendpoint(localip, 10002); udpclient^ udpclient = gcnew udpclient(ep); 

wireshark confirms i'm receiving traffic ip / port doing wrong? there issue in way i'm binding address / port?

wireshark captures everything, while application gets received after filtering.

the problem might lie in sender's side. in essence, subnet mask define part of address defines network , node.therefore, subnet mask being 255.255.252.0 network address 22 bits long.

let's client @ 10.0.16.100\22. broadcasting purposes node address highest possible address reserved. many applications expect netmask 24 bits long (255.255.255.0) , broadcast 10.0.16.255. wrong, because 8 last bits set. proper broadcast address in such subnet 10.0.19.255..

so instead of broadcast appears in case try address. or try 10.10.7.255

edit:

you might overflowing socket buffer , if socket buffer full, sendto blocks until there sufficient buffer space hold message sending.

from http://pubs.opengroup.org/onlinepubs/009695399/functions/sendto.html:

try use usleep(50000);


Comments

Popular posts from this blog

c# - Send Image in Json : 400 Bad request -

jquery - Fancybox - apply a function to several elements -

An easy way to program an Android keyboard layout app -