Send string by using sockets and UDP

Discussion about programs, libraries and tools that work with MicroPython. Mostly these are provided by a third party.
Target audience: All users and developers of MicroPython.
Post Reply
doceave
Posts: 31
Joined: Fri Feb 14, 2020 4:02 pm

Send string by using sockets and UDP

Post by doceave » Sun May 31, 2020 8:40 pm

Hi there

I have an ESP32 that is using almost all available memory --- so much so that I cannot import umqttsimple without memory allocation errors (I do acknowledge that this is likely due to extreme inefficient use of memory by a NOOB)....

What I would like:
> Help with the implementation of the simplest possible micropython UDP send arrangement
> All I need to do is send out data presented in the form of strings to a specific IP address on a LAN
> The device, with near infinite memory could then listen for incoming data and log it.

I know there are many elegant solutions to this... but I would appreciate an example of simple import of the correct library, setup for UDP, and sending of strings.

Many thanks.

User avatar
tve
Posts: 216
Joined: Wed Jan 01, 2020 10:12 pm
Location: Santa Barbara, CA
Contact:

Re: Send string by using sockets and UDP

Post by tve » Sun May 31, 2020 11:52 pm

doceave wrote:
Sun May 31, 2020 8:40 pm
Hi there

I have an ESP32 that is using almost all available memory --- so much so that I cannot import umqttsimple without memory allocation errors (I do acknowledge that this is likely due to extreme inefficient use of memory by a NOOB)....

What I would like:
> Help with the implementation of the simplest possible micropython UDP send arrangement
> All I need to do is send out data presented in the form of strings to a specific IP address on a LAN
> The device, with near infinite memory could then listen for incoming data and log it.

I know there are many elegant solutions to this... but I would appreciate an example of simple import of the correct library, setup for UDP, and sending of strings.

Many thanks.
First thing I recommend is to add `import gc; gc.threshold(4096)` at the top of your boot.py and then see whether it gives you tad more breathing room. If you already have that, then sorry...

Post Reply