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 2 made on Saturday August 1, 2020 at 15:03
Lyndel McGee
RC Moderator
Joined:
Posts:
August 2001
12,645
Several points.

1. You are creating a new socket every time you call the kodi function. Not sure if that is your intent but you can only have 16 sockets open at one time.

2. The socket.onData function you have defined is immediately closing the socket when server sends a response. You won't get any data because you are closing the socket without first 'read'ing it.

3. You talk about using socket.read() with parameters. Parameters are only supported if you are using synchronous/blocking sockets (constructed using new TCPSocket(true)). The example that you have suggests you want asynchronous socket behavior because you are defining onData. I am a bit


In a previous thread where you requested socket help to send command such as MVUp, I provided an asynchronous example that contained a socket.onData function that did a this.read and appended the received data to a string buffer which is initialized as an empty string when the request was made. Can you review that example and then apply to the approach you are attempting.

[Link: remotecentral.com]

Specifically you will likely want to do System.print showing the blocks of data that are received to isolate your issue.

I suspect that the issue you are seeing is because you are not adding a 'Host' header in your HTTP request.

Last edited by Lyndel McGee on August 1, 2020 15:12.
Lyndel McGee
Philips Pronto Addict/Beta Tester


Hosting Services by ipHouse