Closed justmobilize closed 4 months ago
@anecdata and @dhalbert - simple update
We may want to add this to the list, like WIZnet, where the init wouldn't necessarily require a network connection.
It appears that the main change is to work around missing udp "sendto" support in wiznet. Did anyone investigate whether sendto (and any other missing functionality) can be added to wiznet esp32spi instead?
It appears that arduino's version of nina-fw supports socket_sendto but adafruit's fork does not.
if send can substitute for sendto, is there any reason to retain the two runtime branches (sendto & connect+send) rather than just switching to connect+send with a note that it's used for compatibility with nina-fw / esp32spi?
@jepler I will try that. since sendto, basically just does that - it should work
My impression has been that connect
isn't typically used for UDP. In this case it's an artifact of the non-standard way Arduino (NINA) handles sockets. Virtually none of the typical socket code sequences (tcp server/client, udp server/client - especially the servers) that runs on CPython, native wifi, or WIZnet, work in NINA. Maybe we can fudge around that. But yes, sendto
is a bit of a red herring, just a convenient way for now to differentiate (although... does it break CPython?).
edit: looks like connect does work in CPython, either branch would work
@jepler the native socket doesn't have recv
, so either way we are doing special code per chip. This seems the most straightforward... Thoughts?
as the return value of recvfrom_into
is ignored, can't recv_into
be substituted?
But the esp32spi only has recv...
@jepler anything thoughts / recommendations?
https://github.com/adafruit/Adafruit_CircuitPython_ESP32SPI/blob/main/adafruit_esp32spi/adafruit_esp32spi_socketpool.py#L137 I see "def recv_into", is it not applicable?
@jepler okay, I got it as close as I can. The only difference now is the connect method
@jepler that works
Once ESP32SPI is released, I'll update this PR
@anecdata willing to re-test with the newest esp32spi?
@jepler thanks for pushing. I also like this better!
@jepler (or maybe @dhalbert), can this be merged?
Add support for ESP32SPI, which would allow this to be used with:
Merged code from: https://github.com/adafruit/Adafruit_CircuitPython_ESP32SPI/blob/main/examples/esp32spi_udp_client.py