-
|
I have an audio player that streams audio from a server. If the user pauses the audio, the socket stops reading data. I understand that "unused" TCP connections will be torn down after a period of time, by design. However, if the user then resumes the audio after the TCP keepalive expires, the socket has already closed, and I receive a socket error. Is there any way to keep a socket alive for longer? I see that ESP-IDF has a SO_KEEPALIVE setting, but this isn't surfaced to MicroPython:
|
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
|
It would be straightforward to add support for If you were interested in making a PR, this would need to be added to (It's a bit frustrating that ESP32 has its own implementation of |
Beta Was this translation helpful? Give feedback.
It would be straightforward to add support for
SO_KEEPALIVEas it's supported by LWIP (and as you note, the IDF uses LWIP, but we also use it on many other boards). See the implementation ofREUSEADDR, it's much the same, just plumbing.If you were interested in making a PR, this would need to be added to
extmod/modlwip.c,ports/esp32/modsocket.c, andports/unix/modsocket.c(and maybe Zephyr's ports/zephyr/modsocket.c too?).(It's a bit frustrating that ESP32 has its own implementation of
socketeven though it's largely the same as the common LWIP one in modlwip -- it would be good to merge these one day)