I have a question regarding javascript programming of tsu9600 if someone could give me a suggestion.
I have programmed a routine that, given a file name (FileSQ), shows the first text line within it in the "ribbon" widget. Here it is :
var EDev = {}; var hostIP = "readyshare.routerlogin.net"; //Dominio contenuto server var hostPORT = 80; var hostDir = 'shares/U/KMS-Storage'; //Percorso file contenuto server var loadData = ''; var hostFile= encodeURIComponent(FileSQ); //File contenuto server var List = "";
In = loadData.indexOf("#"); Fi = loadData.lastIndexOf("#"); List = loadData.substring(In, Fi);
contenutofile = List;
check = false; Inizio = 1; Fine = Inizio+1; while (check == false) { if (contenutofile.substring(Fine,Fine+1) == "#") { Titolo = contenutofile.substring(Inizio,Fine); check = true; } else { Fine = Fine + 1; } }
ribbon.label = Titolo;
}; EDev.socket.connect(hostIP,hostPORT, 3000);
Since I need to show on the widget a series of files lines, I tried to use this routine in a for cycle, cycling also file name transferred (files are named Playlist 1, Playlist 2 ecc, so it is enough to create strings accordingly and pass them to the routine). But if I do so, system is not working reporting "socket error". I tried several ways but never succeded. Also testing a synchronous routine, if used in a cycle, the system reports "socket error".
Someone that is more skilled than me on this, could give some suggestion about reason and, if existing, a possible solution?