Hello!
I have discovered a "malfunction" within one of my script using pronto pro, i try to explain it in few words.
There is one page which is repeated each 0.5 sec to recover data from a mediaplayer, and make eventual actions depending on data result. The main point is this variables attribution (PlayBackStatus & ElapsedSec):
PlayBackStatus = LanAskAs(hostIPzidoo,hostPORTzidoo,"GET /ZidooVideoPlay/getPlayStatus HTTP/1.0\r\n\r\n");
ElapsedSec = parseInt(PlayBackStatus.split(",")[4].substring(18)/1000); //Tempo trascorso file corrente in secondi
Now what happens. After ending those reading of data after the file playing finishe, script stays in stand-by waiting for new play. When new file play starts, the ElapsedSec remains the latest old values read. This causes malfunction of script since it expects new file, so new ElapsedSec value.
I tried put ElapsedSec = 0 in several positions, but not way: it reports last value from previosus file.
Now my suspect: could it be that the LanAskAs instance (see below), beeing a a-synchronous instance for LAN reading data, remains active even when new file is started?
function LanAskAs(targetIP,targetPort,commandString)
{
var socket, result;
socket = new TCPSocket(false);
result = "";
socket.onConnect = function()
{
socket.write(commandString);
};
socket.onData = function()
{
result += socket.read();
};
socket.onClose = function()
{
Output = result;
};
socket.connect(targetIP,targetPort,3000);
return Output;
}
Consequent question: is it possible to reset all async communication when one file is ended?
Thanks!