-
Notifications
You must be signed in to change notification settings - Fork 936
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
UdpSocket created and used inside async function doesn't work properly #2193
Comments
could it be that you're creating the socket, sending some packet, then immediately dropping the socket? "sending" the packets only enqueues them in the socket buffers, the socket needs to "stick around" for them to actually be sent. |
The buffers are in the main function, so never dropped. |
The buffers don't matter, it's the socket what must not get dropped.
"send_to" only enqueues them in the socket buffers, the socket needs to "stick around" for them to actually be sent.
if the socket buffers are full, it waits until some packets are sent so there's free space.
Currently, the only way is to not drop the socket. We could add a |
Encountered the same problem today. I am interested in implementing a flush function for this, @Dirbaio any directions? |
Ok this is blocked by smoltcp-rs/smoltcp#838 |
Pushed PR on upstream for exporting the necessary symbols |
This issue can be closed? |
I wrote a small program (
ESP32
/no_std
, usingembassy
/embassy-net
) that sends UDP packets and it work just fine.When I moved the networking related code into an async function, it stopped working, UDP Packets wouldn't be sent. Everything seemed to progress properly w/o any errors, but the packets weren't sent.
I pinpointed it to the move of the
UdpSocket::new
into the async function. Once it moved into the async function the packets weren't sent. For the program to work, theUdpSocket
has to be created in themain()
and all the rest can run inside the async function.I thought it might have to do with #2175 but the buffers are created in the main function which never ends (so exist before and after the networking code, so no memory issues).
I tried letting the executor run after calling the new (using
Time::after
) , in case something needs to be processed before continuing in the net_task of .Any ideas what's the reason? Is this maybe by design?
The text was updated successfully, but these errors were encountered: