News:

HOT TIP! Commands and groups can be copied and pasted directly from your command editor to the forum, and vice versa. This makes sharing command XML on the forum much easier!

Main Menu

TCP CPython communication

Started by MrGlasspoole, November 10, 2014, 04:23:00 AM

Previous topic - Next topic

0 Members and 2 Guests are viewing this topic.

MrGlasspoole

Hi,

I'm having some problems with IronPython so i want to use CPython.
The idea is to let VC communicate through TCP with CPython.

From a webpage i can send "VC.On\r\n" and in VC i see "VC.ON:" but VC does not turn into green.
Is there more i need to do?

The other question is how to i send from VC if TCP is running as server and not as client?
I think it must be possible cause in my CMD window i receive "OK" after sending the command above - so VC is sending back!?

Notes:
The whole setup is a little more complicated cause i'm using MQTT and Websockets.
But seeing "VC.ON:" in VC means the CPython asynchat/asyncore <-> VC TCP connection works.

jitterjames

Did you try without the \r\n ?

Please post your python code and the XML for the VoxCommando command that creates the TCP server.

To send a message back you can use a client to connect to your python server.

Because of your specialized needs it might make more sense to write a short iron python code to communicate with your cpython.

jitterjames

If you use the TCP plugin's simple webserver instead of TCP messages you will get responses back for each action you send as XML including the result generated by the action.

For example, if I send the simple web server this http get request:

http://127.0.0.1/api/py.execstring&&result=5*6

I will get the following response:

<action>
  <actionString>py.execstring&&result=5*6</actionString>
  <Success>True</Success>
  <Result>30</Result>
</action>