The CPC host code comes with the python script cpc_iostream_bridge.py under the script folder.
This can be used in conjunction with the cpc_iostream and cli components on the secondary side. Refer to the CLI documentation and IO stream documentation to se tup a CLI application on your secondary device. Once your secondary application and the CPC daemon are running, calling the script opens the CLI endpoint on the host side and opens a network bridge to redirect any data received and transfered on the CPC CLI endpoint over to the network connection. Once the bridge is ready and listening, a telnet terminal can be opened to send and receive data over CPC CLI endpoint.
The cpc_iostream_bridge.py script takes 3 mandatory arguments:
And one optional argument (-v, --verbose) can be passed to enable verbose tracing.
Here is an example of a cpc_iostream_bridge.py usage:
$ python cpc_iostream_bridge.py -n cpcd_0 -l build/libcpc.so -p 8080 -v
BRIDGE: Listen OK
BRIDGE: CPC Init success
You can then test the bridge by opening a telnet connection:
$ telnet localhost 8080
Trying 127.0.0.1...
Connected to 127.0.0.1.
Escape character is '^]'.
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。