Hi Everyone,
I'm using prebuilt esp8266-20161110-v1.8.6.bin
I'd like to use the callbacks on a UDP socket as those described here:
http://docs.micropython.org/en/latest/p ... ocket.html
Unfortunately, I don't seem to be able to find callbacks in 1.8 for esp8266.
I've tried building my own firmware from github ('v1.4.5-2716-gffe807f on 2017-01-05'). I found this version does appear to support callbacks (as part of socket). In this version, I see other modules (such as umqtt) appears to be missing. I'm assuming that v1.4.5 is development, but it's equally possible I don't really understand how git/versioning works properly.
Could somebody please help me to understand the state of support for callbacks on the esp8266? Is this in development, deprecated or am I simply looking in the wrong place?
Any help with understanding the significance of the versioning (ie: 1.4 vs 1.8) or the current state of socket callbacks would be much appreciated.
Can't find UDP socket callbacks
Re: Can't find UDP socket callbacks
Tho one's you cite are for PyBoard only. For ESP, there is a not-yet-documented callback mechanism, which I use for sockets. It might work for UDP too. A code fragment would look like:Unfortunately, I don't seem to be able to find callbacks in 1.8 for esp8266.
Code: Select all
import socket
_SO_REGISTER_HANDLER = const(20)
mysocket = socket.socket(.....) # whatever you set it up
mysocket.setsockopt(socket.SOL_SOCKET, _SO_REGISTER_HANDLER, callback_function) # register callback
def callback_function(mysocket):
.....
.....
Re: Can't find UDP socket callbacks
Hi Roberthh,
Thanks for the excellent reply - since reading it appears I have been retracing your steps.
I found your posts here:
viewtopic.php?t=2496
I'm equally curious why the literal value '20' has been used, one of the first hits I found when following your lead was webrepl.
I tried to go through esp-open-sdk and in particular lwip to understand if a similar option exists for UDP. I'm ashamed to say that I had a lot of trouble following the code once lwip_setsockopt_internal started setting options via sock->conn and then gave up. Did you ever find an answer to your question?
Thanks for the excellent reply - since reading it appears I have been retracing your steps.
I found your posts here:
viewtopic.php?t=2496
I'm equally curious why the literal value '20' has been used, one of the first hits I found when following your lead was webrepl.
I tried to go through esp-open-sdk and in particular lwip to understand if a similar option exists for UDP. I'm ashamed to say that I had a lot of trouble following the code once lwip_setsockopt_internal started setting options via sock->conn and then gave up. Did you ever find an answer to your question?