# Bug in UDP communikation

**URL:** <https://discourse.agopengps.com/t/bug-in-udp-communikation/589>\
**Category:** Bugs\
**Created:** [17 December 2019 20:52 UTC](https://discourse.agopengps.com/t/bug-in-udp-communikation/589 "2019-12-17T20:52:16Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![doppelgrau](https://discourse.agopengps.com/letter_avatar_proxy/v4/letter/d/4491bb/32.png) [@doppelgrau](https://discourse.agopengps.com/u/doppelgrau)\
**Post date:** [17 December 2019 20:52 UTC](https://discourse.agopengps.com/t/bug-in-udp-communikation/589/1 "2019-12-17T20:52:16Z")

</div>

Problem: If you use a broadcast IP in the UDP settings, the Data is not send to the network, instead it goes to loopback.

Solution: In FormGPS after line 880 enable broadcasts for both sockets:  
sendSocket.EnableBroadcast = true;  
recvSocket.EnableBroadcast = true;

---

<div class="post-metadata">

**Author:** ![doppelgrau](https://discourse.agopengps.com/letter_avatar_proxy/v4/letter/d/4491bb/32.png) [@doppelgrau](https://discourse.agopengps.com/u/doppelgrau)\
**Post date:** [17 December 2019 21:19 UTC](https://discourse.agopengps.com/t/bug-in-udp-communikation/589/2 "2019-12-17T21:19:22Z")

</div>

Dokumentation: [Socket.EnableBroadcast Eigenschaft (System.Net.Sockets) | Microsoft Docs](https://docs.microsoft.com/de-de/dotnet/api/system.net.sockets.socket.enablebroadcast?view=netframework-4.8)

---

<div class="post-metadata">

**Author:** ![BrianTee\_Admin](https://discourse.agopengps.com/user_avatar/discourse.agopengps.com/briantee_admin/32/7_2.png) [@BrianTee\_Admin](https://discourse.agopengps.com/u/BrianTee_Admin)\
**Post date:** [19 December 2019 15:19 UTC](https://discourse.agopengps.com/t/bug-in-udp-communikation/589/3 "2019-12-19T15:19:52Z")

</div>

Actually the bug, from what i understand is only in the arduino code. It needs broadcast whereas AOG is not needed, it send directly to the module port number.

Or am i misunderstanding that? Seems to work fine port specific from AOG while being broadcast (no choice) from arduino.

---

<div class="post-metadata">

**Author:** ![doppelgrau](https://discourse.agopengps.com/letter_avatar_proxy/v4/letter/d/4491bb/32.png) [@doppelgrau](https://discourse.agopengps.com/u/doppelgrau)\
**Post date:** [19 December 2019 17:15 UTC](https://discourse.agopengps.com/t/bug-in-udp-communikation/589/4 "2019-12-19T17:15:55Z")

</div>

Yes misunderstanding, aog/Windows is not sending the messages to the right interface without this option when a broadcast IP is configured (and that’s needed in many usecases).

Data goes to loopback instead of WiFi. I can capture and attach some .pcap files if you want.

The problem is on the layer 3 (ip), not on layer 4 (udp/port numbers).

---

<div class="post-metadata">

**Author:** ![BrianTee\_Admin](https://discourse.agopengps.com/user_avatar/discourse.agopengps.com/briantee_admin/32/7_2.png) [@BrianTee\_Admin](https://discourse.agopengps.com/u/BrianTee_Admin)\
**Post date:** [20 December 2019 03:56 UTC](https://discourse.agopengps.com/t/bug-in-udp-communikation/589/5 "2019-12-20T03:56:03Z")

</div>

I am curious, why does it work on ethernet just the way it is?

[https://stackoverflow.com/questions/13361779/udpclient-enablebroadcast-value-has-no-effect](https://stackoverflow.com/questions/13361779/udpclient-enablebroadcast-value-has-no-effect)

So is this a wifi issue only?

---

<div class="post-metadata">

**Author:** ![doppelgrau](https://discourse.agopengps.com/letter_avatar_proxy/v4/letter/d/4491bb/32.png) [@doppelgrau](https://discourse.agopengps.com/u/doppelgrau)\
**Post date:** [20 December 2019 07:41 UTC](https://discourse.agopengps.com/t/bug-in-udp-communikation/589/6 "2019-12-20T07:41:20Z")

</div>

Two theories (untested):

- One of the last Windows 10 started to enforce this behavior
- It only happens if there is no default route on that interface (in my test-Setup, but valid for local only communication)
- After testing again: Windows decides on a unknown base if broadcasts are forwarded or not. Just tried to screenshot it, this time it seems to work. (Should have made a screenshot two days ago when I spent one afternoon chasing the problem why I did not received any PGN over wifi).

But in either case: I think implementing the API behavior can not be a negative thing, especially if it’s as easy as in this case, so we won’t rely on some undocumented behavior.

---

<div class="post-metadata">

**Author:** ![BrianTee\_Admin](https://discourse.agopengps.com/user_avatar/discourse.agopengps.com/briantee_admin/32/7_2.png) [@BrianTee\_Admin](https://discourse.agopengps.com/u/BrianTee_Admin)\
**Post date:** [20 December 2019 15:03 UTC](https://discourse.agopengps.com/t/bug-in-udp-communikation/589/7 "2019-12-20T15:03:34Z")

</div>

I have added those 2 properties. I find the networking stuff pretty tricky. Mostly because i don’t understand it very well.

---

<div class="post-metadata">

**Author:** ![Bada](https://discourse.agopengps.com/letter_avatar_proxy/v4/letter/b/ba9def/32.png) [@Bada](https://discourse.agopengps.com/u/Bada)\
**Post date:** [28 March 2021 11:51 UTC](https://discourse.agopengps.com/t/bug-in-udp-communikation/589/8 "2021-03-28T11:51:10Z")

</div>

Hello, I have a UDP Problem, the Check SUM is green, but i dont recieve any data from Arduin, no steering angle no remote switch etc…  
What could be the Problem?

Regards, Peter
