02-06-2023, 04:51 PM
Hello,
I am still working on sending a data only once, after a delay. The solution so far is too ignore empty data on the server side, which allows me to ignore the data sent at the beggining of the program (the buffer that will be sent is init as empty and I wait for some cycles of analysis to be done before calculating its value).
I used the TimeRuned option in the analysis block to stop the experiment after 5s, and the network connection block is configured to send data each 4.9s.
So far so good: it works for the first run. But then I wanted to be able to hit the play button again without clearing the data (the bin icone). I decided to play with the clear="true" attribute from the <send></send> block. My idea was to clear the buffer after the data has been sent to the network, at the end of a 5s run, so that at the beggining of the next 5s run the buffer would be empty, and the connection to the network ignored by the server.
this long introduction to come to this point: when I tried to clear the data (<send id="data" type="buffer" clear="true">time</send>), it seems that the data was cleared before being send to the network: my server only receive empty data, never any actual data.
I was never able to send any data with the attribute clear set to true. Am I missing something?
I post below a minimum example displaying the problem: two data are sent to a network, one with the clear attribute set to true (timer1), the other set to false (timer2). Timer1 always arrives empty on the server, whereas timer2 arrives with a value (in this example, 2 connections are made, one at the beggining of the analyse, the other at the end, both with the same result.) Note that if you want to test this program on your server, you need to enter the correct address.
Thank you in advance for any help,
Cheers,
Fred
PS: I think I could go around this problem by detecting if the pause button has been hit and manually emptying the buffer, but I would like to understand. By the way, is there an easy way to detect if the pause button has been hit ? I can do it by measuring the time elapsed between two analyses cycles, but it is a bit cumbersome ...
I am still working on sending a data only once, after a delay. The solution so far is too ignore empty data on the server side, which allows me to ignore the data sent at the beggining of the program (the buffer that will be sent is init as empty and I wait for some cycles of analysis to be done before calculating its value).
I used the TimeRuned option in the analysis block to stop the experiment after 5s, and the network connection block is configured to send data each 4.9s.
So far so good: it works for the first run. But then I wanted to be able to hit the play button again without clearing the data (the bin icone). I decided to play with the clear="true" attribute from the <send></send> block. My idea was to clear the buffer after the data has been sent to the network, at the end of a 5s run, so that at the beggining of the next 5s run the buffer would be empty, and the connection to the network ignored by the server.
this long introduction to come to this point: when I tried to clear the data (<send id="data" type="buffer" clear="true">time</send>), it seems that the data was cleared before being send to the network: my server only receive empty data, never any actual data.
I was never able to send any data with the attribute clear set to true. Am I missing something?
I post below a minimum example displaying the problem: two data are sent to a network, one with the clear attribute set to true (timer1), the other set to false (timer2). Timer1 always arrives empty on the server, whereas timer2 arrives with a value (in this example, 2 connections are made, one at the beggining of the analyse, the other at the end, both with the same result.) Note that if you want to test this program on your server, you need to enter the correct address.
Thank you in advance for any help,
Cheers,
Fred
PS: I think I could go around this problem by detecting if the pause button has been hit and manually emptying the buffer, but I would like to understand. By the way, is there an easy way to detect if the pause button has been hit ? I can do it by measuring the time elapsed between two analyses cycles, but it is a bit cumbersome ...