-->
Page 1 of 1

Runtime behaviour net.server:listen()

PostPosted: Mon Oct 19, 2015 5:36 am
by tester9
Hi,

I have a question to runtime behaviour of the nodemcu.
I would like to transfer some measured values from one device to another. The first device reads the values from sensors and provides the values with a small web server. The second device requests the values from the web server.
The reading of the sensors might take some time and should not be interrupted by an external request. It should be no problem if the response of the web server is a bit delayed.
Maybe my questions are much too detailed: How is net.server:listen() realized? Is it working like an interrupt? Or is this function called after another function has ended?
So maybe the device is inside the sensor reading function can I set a flag to delay the request of the server function?

Similar race conditions might happen if long multiple long timer routines are used. I found no documentation about this.

Re: Runtime behaviour net.server:listen()

PostPosted: Mon Oct 19, 2015 9:43 pm
by lethe
Why don't you just push the data from the ESP with the sensor to the other one, instead of polling it? That way can control when the transmission happens and guarantee that it won't interfere with the readout.

Re: Runtime behaviour net.server:listen()

PostPosted: Wed Oct 21, 2015 8:18 am
by tester9
This would be an idea.

But does exist something like semaphores? And are internally interrups used when an connection is established?