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:
3-way handshake with TCP connection
This thread has 7 replies. Displaying all posts.
Post 1 made on Tuesday May 19, 2020 at 04:37
Fbrighi
Long Time Member
Joined:
Posts:
September 2010
52
Hello, i was trying to make pronto script works with a client that needs 3-way handshake to react to commands. With standard tcpsocket procedure i'm not able to connect and/or control the device.

Is it existing some special syntax/command to allow pronto script for a 3-way handshake connection over TCP?

Thanks!

FKB
FKB
Post 2 made on Wednesday May 20, 2020 at 11:19
sebastian
Long Time Member
Joined:
Posts:
September 2003
93
Can you be more specific?
The term "3-way-handshake" usually refers to TCP's method of establishing a connection using SYN/SYN+ACK/ACK flags.
This behavior is hardcoded into the IP-stack of the device and there is no way you could establish a TCP connection without following that standard.

Sebastian
OP | Post 3 made on Wednesday May 20, 2020 at 14:57
Fbrighi
Long Time Member
Joined:
Posts:
September 2010
52
Hello, thanks for your reply. Yes, sure.

JVC projectors can be controlled by lan, with TCP/IP protocol, but ask for a specific 3-way handshaking. In particular, the sequence as for JVC instructions must be:

Contoller -> connection request
JVC -> PJ_OK
Controller -> PJREQ
JVC -> PJACK
Controller -> Command you need to be executed

Here more detail (see from page 22) : [Link: support.jvc.com]

They call this as "3-way handshake" but it seems they require also the data sent as Syn and as Ack is customized (PJREQ). I tried to use normal TCP socket to send JVC command i need to execute, but projector is not executing them.

I'm not able to receive the PJ_OK from JVC after trying a TCP socket, it reports always "socket error". JVC is working correctly, because if try connection by Telnet, i obtain the PJ_OK answer.

Is there any way to enter in this 3-way handshaking somehow?

Thanks!

FKB

Last edited by Fbrighi on May 20, 2020 15:04.
FKB
Post 4 made on Thursday May 21, 2020 at 19:14
Lyndel McGee
RC Moderator
Joined:
Posts:
August 2001
12,996
3 way handshake means wait for ready from the projector, send an intent to send a request and wait for controller to acknowledge, then send the command.

This is just a standard TCP/IP socket with the projector listening for new connections on port Port 20554.


Create the TCP-IP connect from Pronto on port 20554. Wait until you get PJ_OK. Then send the PJ_REQ. Wait for receipt of the PJ_ACK. Finally, send the command you want to send and according to the documentation, projector will close the socket after 5 seconds.

To quote you...

"I'm not able to receive the PJ_OK from JVC after trying a TCP socket, it reports always "socket error". JVC is working correctly, because if try connection by Telnet, i obtain the PJ_OK answer."


If you send PJ_REQ from telnet, do you get back a PJ_ACK? If you can make this work (ensuring you don't breach the 5 second rule) via telnet(might get stuck sending hex chars below), you should be able to make this work from ProntoScript

Sounds like your issue is with your script. A picture, or in this case, the code you are trying to test with, is worth 1000 words.


Note that the commands you send are NOT strings of numbers.
The are hex values. So when you want to send them to the socket, you'll need to use string concatenation.

var cmdString = "";
cmdString += String.fromCharCode(0x06);
cmdString += String.fromCharCode([next hex digit pair]);
cmdString += String.fromCharCode([next hex digit pair]);
cmdString += String.fromCharCode([next hex digit pair]);
// 0x0A is an ASCII LineFeed character
cmdString += String.fromCharCode(0x0A);

sock.write(cmdString);


Lyndel

Last edited by Lyndel McGee on May 21, 2020 20:02.
Lyndel McGee
Philips Pronto Addict/Beta Tester
Post 5 made on Thursday June 4, 2020 at 05:28
Anthoiny
Junior Member
Joined:
Posts:
June 2020
1
TCP uses a three-way handshake to establish a reliable connection. The connection is full duplex, and both sides synchronize (SYN) and acknowledge (ACK) each other. The exchange of these four flags is performed in three steps—SYN, SYN-ACK, and ACK—as shown in Figure 3.8.

https://www.upsers.mobi/
Post 6 made on Friday June 5, 2020 at 20:47
Lyndel McGee
RC Moderator
Joined:
Posts:
August 2001
12,996
Anthoiny,

I know about the TCP/IP handshake but in the JVC Projector protocol above

I am of the opinion that the handshake they discuss is in the data plane of messages across the socket, not the TCP/IP socket negotiation control Plane.

I believe that at this step in Fbrighi's initial writeup is where this 3-way handshake occurs.

Controller -> connection request

The protocol document at [Link: support.jvc.com]
is somewhat misleading.

Following TCP/IP connection, users just first wait for PJ_OK to be received and then they can follow with 'PJ_REQ\n'. Next wait for 'PJ_ACK\n', and then
send command bytes + Linefeed (\n).

If you need to send multiple commands ensuring that there is no more than 5 seconds elapsing between commands, it appears you may be able to send 'PJ_REQ\n', then wait for another 'PJ_ACK\n', and finally send command #2 bytes + Linefeed.


;-)

Last edited by Lyndel McGee on June 5, 2020 21:04.
Lyndel McGee
Philips Pronto Addict/Beta Tester
OP | Post 7 made on Sunday June 7, 2020 at 07:46
Fbrighi
Long Time Member
Joined:
Posts:
September 2010
52
Thanks to all, i finally get rid of the issue.
The problem was not the 3-way handshake, but the reading instruction from connection. It was initially set up to "capture" 300 chars:

Status = SocketPlay.read(300,3000);

but JVC is answering with much shorter string, so once changed to

Status = SocketPlay.read(10,3000);

It worked perfectly. Thanks to all :)!!!

FKB
FKB
Post 8 made on Sunday June 7, 2020 at 12:28
Lyndel McGee
RC Moderator
Joined:
Posts:
August 2001
12,996
Glad you got it sorted.

Last edited by Lyndel McGee on June 7, 2020 12:37.
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