Your Universal Remote Control Center
RemoteCentral.com
Philips Pronto Professional Forum - View Post
Up level
Up level
The following page was printed from RemoteCentral.com:

Login:
Pass:
 
 

Original thread:
Post 1 made on Wednesday July 19, 2017 at 04:01
Fbrighi
Long Time Member
Joined:
Posts:
September 2010
52
Hello all,

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 = "";

EDev.socket = new TCPSocket(false);
EDev.socket.onConnect = function() {
EDev.socket.write( "GET /"+ hostDir + hostFile + " HTTP/1.0\r\n\r\n");
};
EDev.socket.onIOError = function (e) {System.print("IOError " + e)};
EDev.socket.onData = function() {loadData += EDev.socket.read();
};
EDev.socket.onClose = function() {EDev.socket=null;

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?

Thanks and regards
FKB
FKB


Hosting Services by ipHouse