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 21 made on Monday September 13, 2010 at 02:10
Guy Palmer
Active Member
Joined:
Posts:
June 2008
648
When receiving data, you have to make sure that you receive it all, split the messages, handle carriage returns, etc. This means that the code should be more complicated than your version. Try the following and report back what System.print messages are generated in the debug panel.

function Feedback()
{
Response = "";
Socket = new TCPSocket();
Socket.onConnect = function () {Socket.write("\\05FF0073073800\r");};
Socket.onData = function ()
{
if (Socket.connected === true)
{
Response += Socket.read();
while(Response.indexOf("\r") != -1)
{
StringLen = Response.indexOf("\r");
ReceiveString = Response.substring(0,StringLen);
if(ReceiveString.substring(0,1) == "\n")
{ReceiveString = ReceiveString.substring(1);}
if(Response.indexOf("\r\n") != -1)
{Response = Response.substring(StringLen+1);}
else {Response = Response.substring(StringLen+2);}
System.print("received string: " + ReceiveString);
}
}
};
Socket.onClose = function () {};
Socket.onIOError = function(e) {};
Socket.connect("192.168.10.25", 8005, 30000);
}


Hosting Services by ipHouse