-
Notifications
You must be signed in to change notification settings - Fork 13.3k
UDP bidirectional communication not working #64
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Apparently nerds of a feather flock together- I just found the same issue - my router/GW is 2.1, the ESP8266 is at 2.123, the target NTP server was resolved to 129.6.15.30. *** How do I raise this specific bug wrt #include <WiFiUdp.h> using the wrong source port? root@knightswhosayni:~# tcpdump -nvX host 192.168.2.123 // OK - looks like ARP is working.... that's a start 14:47:59.718364 IP (tos 0x0, ttl 255, id 52, offset 0, flags [none], proto UDP (17), length 76) |
Also - from repetition and trying different ports, it looks like regardless of the originating port specified, that the UDP is allocating a dynamic port from 4096 to (some higher number) - the resulting packet originates from some port above 4096 (and the reply comes back to that same bogus port). Any ideas? |
@tim-in-oakton That's excellent additional information for IGRR to get this thing sorted. He's probably the only one to get to the bottom of this. |
For what it's worth (haven't been a C jockey since 1990, muscles are weak and flabby.....), It looks like the originating port info is tight through the code that I can read - in the UdpContext there is a call made to udp_bind which appears to be supported via a precomplied binary called "liblwip.a" . The call made to udp_bind passes three parameters - It looks like the right origination port info is making it to the call to the lib, maybe it's getting after this point... |
One more small observation as I try to hack something workable - HTH! |
hold on guys, I'm on it... |
Yay!
Now just a small cleanup and I'll push the fix. |
Good show Ivan! Could you share the code snippet too? Greetings, |
scandone connected with BestWestern, channel 1 Starting connection to server...
|
@igrr Does the fix also apply to the beginMulticast procedure? |
I'm having a related problem. I have two sketches running on two different ESP's. Sketch1
Sketch2
I have doubts on my implementation on sketch2. Is it ok? @igrr |
@alfonsohera Hi Alfonso, did you ever get this to work? I'm having the same problem trying to make a bidirectional UDP communication between two ESPs. Thanks! |
Hello Ivan,
The UDP library works OK for unidirectional communication (either as Client or Server).
It does NOT work as expected for bidirectional communication, therefore getting time from an NTP server is not possible.
There was an issue #53 opened, but this was closed without a solution.
Looks like a bug.
Have a look at background findings from various users here:
http://www.esp8266.com/viewtopic.php?f=28&t=2295&hilit=udp
http://www.esp8266.com/viewtopic.php?f=29&t=2390&hilit=udp
Regards,
Gerard.
The text was updated successfully, but these errors were encountered: