Live streaming data from PC to PC in c++ - c++

I'm new in sending and receiving data from one PC to another. Currently i have an application in c++ generating data in Ubuntu where i need to stream those data from packet by packets to my mac. I have been told to use RapidJson and CRUL. But i found it difficult to understand. Im not sure which one will be the best solutions as match to my situation
1) An application in c++ running in Ubuntu continuous generating data at PC-a.
2) At PC-b i have an QT c++ running in Mac application where need to receive those data live from PC-a
3) At PC-b must know it must listening to only PC-a receiving data.
Is anyone can help to provide a sample simple example so that i follow?

Related

orocos ros integration, createStream causes execution to stuck in a loop

I'm integrating orocos with ros, basically i created a component that read data from some input ports and write on output ports that create streams, because i want to public this values on ros topics and then read those values in plotjuggler.
So I created this component without any problem and work perfectly. After that i created used another ssd configured in the same way as the previos ssd in which i build this component that publish data on ROS but on this new ssd when i call the first createStream() it stuck without any error as if it is in an infinite loop. The only thing that i notice different from the other ssd is that i got the following message
[2022-05-06 12:33:28] [connect] WebSocket Connection 192.168.2.13:8081 v-2 "WebSocket++/0.7.0" /socket.io/?EIO=4&transport=websocket&t=1651833208 101
to create the stream I'm using, in the c++ code the following code
port.setName(<port_name>);
port.doc(<doc>);
port.createStream(rtt_roscomm::topic(<topic_name>));
i also tried to create the stream in the ops file, but i get exactly the same result, when it reach that point it stuck.
I repeat again that i have a working version of this component on a similar ssd, so this means that the code inside the component is should be correct
as well as the ops file.
I'm on ubuntu 18.04.06 LTS, I'm using ROS melodic.
Is 1 week that I'm working on this issue without success, so i tried a lot of different things but at the end when i create a stream it stuck.
Ros is working because if i create a topic and i publish something from terminal or a create a simple ros package i can send and receive data, also orocos is working because i have different component running without problem.
I know that with so few information is difficult to solve the problem but why when i create a topic, with createStream, i get stuck in this loop?
There is any known case in which it is possible to remain stacked in this way during the creation of a topic in ros?

Custom dashboard for car; Reading OBD II data using C++?

So I am in a bit of a dilemma, I want to create a LED dashboard using my Raspberry Pi, the only problem is how am I going to read the data to the Raspberry Pi using C++? I am thinking about buying an OBD to USB connector and reading the data from there, but it still doesn't change the fact that I would need parse the data, but the only library I found for OBD on C++ is https://github.com/lkrasner/obd-cxx but it does not look promising.
So this is where I turn to the Stack Overflow community to help me out because I have run out of options.
Can the OBD data be read as serial? If it was serial, wouldn't that be too slow for a real-time speedometer? Should I use another port instead of OBD?
I have quickly searched and found this topic: http://blog.lemberg.co.uk/how-guide-obdii-reader-app-development
It is not usb, but it tels about AT commands to communicate with the adaptor. Thus, I would assume the USB one will be visible as a serial interface with the same communication principle. Then you might not need a library, as you can directly read-write your serial device.
Make sure only, that the adaptor you're gonna buy supports the communication protocol of your car (CAN or another). Perhaps also one option to think about is whether the adaptor provides high-level commands for you (then you need to check that the required diagnostics services are supported by the adaptor), or you need to build/parse the raw diagnostic messages yourself (I think this would be more flexible solution).

Receiving WebRTC call from a C++ native Windows application

I would like, from a native Windows application using C++, to receive video/audio data sent from a browser located in a remote location. It seems like WebRTC is the way to go for this.
Most information I find is about how to interact with the browser to write WebRTC apps, but it may case the data would be received by my C++ app. Is it correct that I would need to use the WebRTC Native Code package for this, which is described as being 'for browser developers'? Document is located here: http://www.webrtc.org/webrtc-native-code-package
And what if I want to send video/audio data that I generate (ie not directly coming from a webcam and microphone), would I be able to send it to the remote location browser?
Any sample code out there which does something like I'm trying to accomplish?
The wording in that link is a bit misleading. They intend people that are developing browsers to use the native code, and advise those that are developing "applications" in a browser to use the WebRTC API.
I have worked with their native code for over a year to develop an Android application that is capable of performing audio and / or video calls between other Android devices and to browsers. So, I a pretty sure that it is completely possible to to take their native code and create a Windows application (especially since they have example code that does that for Linux and Mac -- look at peerconnection client and peerconnection server for this). You might have to write and re-write code to get it to work on Windows.
As for as data that you generate. In the Android project that I worked with, we didn't rely on the Android device / system to provide us with video, we captured and sent that out our selves using the "LibJingle" / WebRTC libraries. So, I know that that is possible, as long as you provide the libraries with video data in the correct format. I would imagine that one would be able to do the same with audio, but we never fiddled with that, so I cannot say for sure.
And as for example code, I can only suggest Luke Weber's gitbug repositories. Although it is for Android, it might be of some help to look at how he interfaces with the two libraries. Probably the better code to look at is the peerconnection client stuff that comes in the "LibJingle" second of the native code. [edit]: That is located in /talk/examples/peerconection/client/ .
If you get lost from my use of "LibJingle", that will show you when I started working with all of this code. Sometime around July of 2013 they migrated "LibJingle" into the WebRTC "talk" folder. From everything that I have seen, they are the same thing, just with the location and named changed.

Send a stream of bits down a usb data line

All I want to do is send some data down a specific data line in a usb cable.
I'm currently trying to use linux, c/c++, and libusb, however between getting libusb working, linking the library, and actually building it, everything seems to fail.
Is there an entirely easier way to go about doing such a simple task?

Best Way to Send Data from C++ program to Rails Server

I have a C++ program that is constantly generating a large amount of data that needs to be sent to a Rails server. Both the program and the server are on the same machine running Suse Linux.
What is the most efficient and simple solution for this?
Sockets are the way to go. If you want some good asynchronous and cross-platform sockets in C++ your best bet, probably, will be boost::asio.
You could store the data the way you want (file or database).
The only tough point is to make your Rails app aware the C++ program is completed.
I'd strongly advise you to store this information in cache so that it won't cost much to check this every period you need.
You could use sockets since both your programs are residing on the same local machine, and in general it should be pretty straight-forward to send the serialized data over a local socket. Since the socket is using an internal buffer, the transfer time should be very fast. Your C++ program can either push data to the Rails server, or you can have the Rails server poll the C++ program providing you're setting up a cache in your C++ program to store the data in between polling calls. The push method would probably work best though.