-
Notifications
You must be signed in to change notification settings - Fork 13.3k
WIFI UDP no longer receives data after data is sent #53
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
Guess this is not the right way to solve the issue, but this workaround works for me: void sendMessage(char data[]) { |
Yes, i think this is the right way — just create two WiFiUDP instances, one listening, one transmitting. |
Thank you, that makes sense. It would be helpful if things like this were documented. Is there somewhere where people are able to contribute to documentation as I would be willing to add to it if there were. |
This does seem related to #64, if the beginpacket does whack all info. That said, it is important to be able to send a UDP packet and receive the response - which seems like a different use case than above- |
Mhm, i guess I need to read through the original WiFiShield library source code again — perhaps I messed up UdpClient's semantics. |
Arduinos site shows that you can send data back to the sender through a single UDP connection. But I had the same issue as roberttang30. I wanted to receive from a UDP port and respond using a know port. Once i sent data i could no longer receive data. I think this must only work when you respond to the senders port. Using two UDP objects the way mvdbro said works for me. I'm using TouchOSC to send receive to the ESP and having two UDP objects work. One for send and the other for receive. Thanks. |
here is working send and receive with only one (WiFiUDP Udp;) instance. sending and receiving OSC |
Alse posted on ESP8266.com forumn.
I'm not entirely sure that this is a bug but I can't see any other explanation for the behavior. I am using the following code on which is connected to a python script which essentially acts as a terminal-esque way of sending and receiving data to the ESP. The code below works and I can have the light set on or off. The problem is that, after a message has been sent using sendMessage, the ESP will no longer receive packets. I can see from the serial output that the loop is still running and if I remove the call to sendMessage, it will continue turning the light on and off merrily. I wonder if I'm just missing something?
From what I can see, it looks like the call to beginPacket in WiFiUDP.cpp resets everything when it calls: _ctx->unref();
In order to try and get around this I have tried calling stop and then begin again after a transmission to restart the listening but to no avail.
The text was updated successfully, but these errors were encountered: