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

Login:
Pass:
 
 

Topic:
Bug in the developers guide ?
This thread has 1 response. Displaying all posts.
Post 1 made on Friday April 17, 2009 at 13:25
RolandTanguy
Long Time Member
Joined:
Posts:
August 2008
22
As a new javascript developer, it took me a while to find out what was wrong in the script given P.43 of the developers guide and fix it...

In the DG we can read :

var socket = new TCPSocket(false);
var result = "";
socket.onConnect = function()
{
write("GET /; HTTP/1.0\r\n\r\n");
};
socket.onData = function()
{
result += read();
};
(...)

And as it it does not work (at least with me...)

So i had to add to transform
"write" into "socket.write"
and
"read" intot "soclet.read"
to make ot work properly

so the code now is :

var socket = new TCPSocket(false);
var result = "";
socket.onConnect = function()
{
socket.write("GET /; HTTP/1.0\r\n\r\n");
};
socket.onData = function()
{
result += socket.read();
};

(...)

BTW, if it is a question of "scope", maybe it might work somewhere else but for me it solved the problem and this post is for the beginers as i am, so they can save time...
And I also think that the code is much more clear that way.

HTH,

Roland, Paris, France
Roland, Paris, France.
"Irules" user (and quite happy with it)
Post 2 made on Friday April 17, 2009 at 14:20
Lyndel McGee
RC Moderator
Joined:
Posts:
August 2001
13,007
Instead of 'socket' above, you can use this.read() and this.write() while inside a callback. See the Appendix in the Dev Guide describing sockets and the 'this' keyword in the Callbacks section.
Lyndel McGee
Philips Pronto Addict/Beta Tester

Jump to


Protected Feature Before you can reply to a message...
You must first register for a Remote Central user account - it's fast and free! Or, if you already have an account, please login now.

Please read the following: Unsolicited commercial advertisements are absolutely not permitted on this forum. Other private buy & sell messages should be posted to our Marketplace. For information on how to advertise your service or product click here. Remote Central reserves the right to remove or modify any post that is deemed inappropriate.

Hosting Services by ipHouse