Reply To: [Solved] Sending commands via TCP did not work

Home Forums V-Control General [Solved] Sending commands via TCP did not work Reply To: [Solved] Sending commands via TCP did not work

#640
Dierk
Participant

Hi Marcus, thank you for joining us.
The message “lost connection” is impossible if you are using V-Control remote services. If V-Control act as remote server it could not loose a connection because the client decides to connect or not. Only the client can lose a connection. A server only offers a connection. If a client disconnects, then the connection is ended, but from the servers point of view the connection is not lost, the client simply ended it.
I suspect that you have set up a device, probably a generic device, that should connect to your Raspberry Pi. In that case you need a TCP sever on your raspberry, which is impossible to establish by echo commands (as far as I know and surely not as you did in your example).

If you use the Raspberry Pi as TCP client (and your demo code suggests that this is what you want to do), you need to set up V-Control as remote server. Select “Configure -> Options” from V-Controls main menu and select the tab “TCP”. Choose a port and check the box “Enable TCP Services”.
Now V-Control is ready to receive commands by its remote control protocol. The protocol is not pure ASCII code. I’m not so familiar with Linux bash, but I know that sending a command such as

echo “(4)0(5)scrRunTask(5)Shutdown_All_PCs(6)” > /dev/tcp/192.168.100.1/10101

could not work. The reason is that the command and parameter separators in the V-Control remote protocol are not ASCII characters. As explained here http://v-control.com/wiki/doku.php/remoteprotocolgeneral you have to send the digital value as separator.

If you type
echo “(4)0(5)scrRunTask(5)Shutdown_All_PCs(6) > /dev/tcp/192.168.100.1/10101

in your Linux terminal, you send the braces and the “4” as ASCII code. “4” is ASCII code 52. You need to send 4 as value, and no braces. It is explained in the documentation (possibly not clear enough). You have to send values in braces as digital value. I don’t know how to to this in a bash, an example in BASIC language looks like this:

Dim s as string
s = chr(4) + “0” + chr(5) + “scrRunTask” + chr(5) + “Shutdown_All_PCs” + chr(6)

There is also a Tutorial explaining the difference using remote services and device events here: http://v-control.com/wiki/doku.php/tutorials:multiple_v-io_boxes_for_push_button_events

Scroll to top