This is my first practical, real world ESP project and I learnt a lot in these exchanges. The final working code will act as a template for my future projects too.
The code you have given starts off working very well. But again, very mysteriously, it stops echoing UDP inputs after (usually) about 35 to 40 cycles, or even sooner. From some further research I have been able to determine that when this happens, the ESP is still receiving data, its just not re-transmitting it. At the same time, it has no problems transmitting the switch status, even in this 'hung' state.
At this point, as earlier, the module still transmits the switch status when it changes, and the LED also is flashing happily the way its supposed to.
I tried another ESP8266 01 (1MB) as also an ESP8266 07; no joy.
Lastly, tried powering the setup from another, more robust supply, just to eliminate possibilities.
Again, no luck.
Absolutely stumped by this issue. Can you think of a cause for this?
Anand.