how to read write labview network shared variable from c++ - c++

LabVIEW gives the possibility of sharing variables over the network. I would like to be able to read and set those variable from my C++ code. (I run under linux system)
I read there are some DLL API for communication but of course they do not fit my purpose.
I guess we the whole communication should be simply based on sockets and therefore I guess should be more than feasible from linux environment.
Does anyone have some information/ideas about this topic?

It's not very easy to find it on the website but I have been pointed out to an official library, NI LabWindows™/CVI™ 2009 Help - Network Variable Library, that should do all the magic.
I haven't tested it yet though.

Looks to me like they only support interop with C++ on Windows.
You'd have to reimplement the entire crosstalk mechanism yourself, by reverse engineering their comms protocol. Not trivial!

Having no way to implement LV shared variable protocol (as Tomalak's post says), your best bet to enable communication between both would be to
use another messaging protocol, like ZeroMQ, and make bindings for LabVIEW.
use raw TCP or UDP sockets, both being supported in LabVIEW and C++

Related

Cross platform C++ UDP socket library

Can somebody recommend a free C++ open source library which I will use to build a networked game using UDP. Must be available for Windows/Linux/Mac. As lightweight as possible please.
How about SDL_Net? Not C++ really, but is lightweight and cross-platform.
http://enet.bespin.org/
A very advanced C UDP-based library, with multiplexing, reliable/unreliable/unsequenced/fragmented delivery. Cross platform. Used and created for an established open source game (Cube 2: Sauerbraten), and if you nibble at its mailing list, you'll see that it's sometimes used for commercial games too.
I'm not using networking myself in C++ but I would give Boost asio a try if I had to do networking.

JGroups equivalent library in C++

at work we have been using JGroups and I have to say that I really like it, however, at home I primarily build with C/C++.
I'm wondering if anyone knows of any good/solid ports of JGroups to C++ or any other equivalent software library for C++. I'm interested in hearing pros/cons of various libraries out there.
Though this isn't a requirement, I am most familiar with SDL's SDL_net so a nice wrapper class around SDL_net would be the most favorable to me.
I don't know of any ports of JGroups to C++. Some folks run JGroups as a daemon and then talk to it from other languages via a protocol. I recently created a STOMP protocol, which allows for messages sent by clients written in different languages to be processed by JGroups, and for those clients to receive messages as well.
Re: native stacks, you could take a look at Spread (www.spread.org).
You might want to check out 0mq. Its pretty fast and easy to use.

Portable lightweight C++ sockets wrapper

I really thought this would be easier to find...
I need a portable c++ sockets wrapper. I'm planning to use it for a windows server application and a client that will be running on a embedded device running ulinux (or something similar). I would use Boost but I need it to be lightweight and easy to add to the embedded device project.
Also I would like it to be a "higher level" wrapper... so it starts a background thread to read data and informs be over a callback...
Any ideas?
I'd suggest Boost.Asio. Despite it's name, you are not forced to use asynchronous I/O. You could use synchronous I/O and threads, as your question implies.
Boost.Asio is a cross-platform C++
library for network and low-level I/O
programming that provides developers
with a consistent asynchronous model
using a modern C++ approach.
Just learn to use the socket API directly. You can then easily wrap it yourself. It's not that hard, and you can get started with Beej's excellent guide. As Beej says:
The sockets API, though started by the
Berkeley folk, has been ported to many
many platforms, including Unix, Linux,
and even Windows.
In his guide he details the very small addition you need to do to get the same API in Windows and *nix systems.
Once you've learned, wrap it yourself if you're so inclined. Then you can control exactly how "lightweight" you want it.
If you really don't like Boost asio then you might like the sockets support in dlib. It is simpler in the sense that it uses traditional blocking IO and threads rather than asio's asynchronous proactor pattern. For example, it makes it easy to make a threaded TCP server that reads and writes from the iostreams. See this example for instance. Or you can just make a simple iosockstream if not acting as a server.
I know this is old, but there is a very nice and simple implementation in below location which I'm using for personal use. Had implemented my own wrapper a while back but lost the code and found this one online which is much better than mine:
http://cs.ecs.baylor.edu/~donahoo/practical/CSockets/practical/
Take a look at ENet http://enet.bespin.org/ it is very lightweight and portable and works on top of UDP, with optional support for reliable packets. It is easy to use, the API is low-level and with little performance overhead. You have a high degree of control over the memory management, which could be good if networking is a bottleneck for you and the malloc/new implementation you use performs badly under multithreading.
It would not be that hard to implement your high level thread “optimally”, since there is optional support for blocking receive and the library is a “library” and not a framework therefore you are the decision maker instead of the library.
Perhaps you can have a look at http://www.pt-framework.org/
Old question, but for C++, BSD style synchronous sockets this is about as minimal baggage wrapper as you can find
http://code.google.com/p/ting/source/browse/trunk/src/ting/net/
It does come with exceptions. You could make a bit more lightweight one as a header-only template library, and maybe make exceptions optional, but that would change the API a bit
POCO network classes are quite similar, but do require more dependencies from other parts of the Poco lib
I'm personally creating my own AsIO wrapper for both TCP and Serial sockets, and I started by reviewing the following tutorial:
https://www.gamedev.net/blogs/blog/950-they-dont-teach-this-stuff-in-school/
and
https://objectcomputing.com/resources/publications/mnb/multi-platform-serial-interfacing-using-boost-a-gps-sensor-and-opendds-part-i/
I found the first one very useful and simple to understand.
C++CSP2
Used it loved it. Stable and powerful

Network programming using C++

How can we do network programming in C++ similar to Remoting in .NET? Please help with any tutorials.
It would be fine if I know how to enable two computers to communicate in the form of sending and receiving messages using C++/C#.
Thanks,
Rakesh.
For windows, you can check out this.
You could refer Beej's guide for Unix flavors.
C++ does not have any native networking libraries, so if you don't want to use OS specific calls, you are going to need to use a portability layer.
Two that come to mind are Boost ASIO and ACE.
You may want to have a look at the Poco C++ libraries. Especially the Net module.
For a pure C++ solution (as your first sentence suggests) that's also really simple to use, checkout RCF.
If you want to communicate between C# and C++ programs (as your second sentence suggests) you'll have to look elsewhere, sorry.
Check out our C++ Remoting framework. There's also a screencast showing how to use it.
This is probably the closest that you'll get to .NET Remoting in C++.

Qt portable IPC: only QSharedMemory?

I'm looking for suggestions about choosing a portable way to achieve local IPC in a robust way, since i'm new to C++ and would like to avoid common pitfalls of fiddling with shared memory and locks; therefore I was thinking about message-passing style ipc.
I was planning to use qt for other reasons anyway, thus i took a peek to Qt ipc options.
if i understand correctly qt doesn't offer a completely portable message-passing ipc feature. it can use d-bus, but using it on windows would be a problem. other ways are limited to embedded linux platforms (and i would like to port this thing to AIX).
I could not find a "signal and slots" or message-passing style implementation that uses QSharedMemory and QSystemSemaphores
Thus: Am I limited to implement a feature on QSM/QSS?
what other options could i study?
posix pipes? protocol buffers? boost queues and messages ?
I'm considering to release the code under LGPL/GPL style license, does this rule out protocol buffers or boost libs?
please, again, the interface must be simple and newbie-proof (otherwise i definitely will screw up things big time for sure :) ), and so should the serialization/deserialization of types, error handling and resource disposal.
Take a look at Boost.Interprocess which provides a lot of IPC functionality. I have used the interprocess message_queue that provides a pretty clean and easy way to do what I think you want to do.
You can use QLocalSocket and QlocalServer for IPC too.
Those two classes are really easy to use and they can be implemented ~almost the same way as you would using Qt TCP socket client/server.
You can take a look at some of these youtube videos:
QTCPServer - a basic TCP server application
QTcpServer using multiple threads
(Almost the sames principles would apply for "Local" server/client instead of "TCP")
As Qt 5.9, there is module which is currently under technology preview name QtRemoteObjects which provides Qt native IPC for QObjects, its easy to use and could be used to share signal/slots and also models between two processes.
Its works well for Linux, Windows and android