I have some C++ services running on server and a node server program listening to a specific port. Can I use shared memory between C++ services and nodejs program? I want users to send data through nodejs server and those C++ services access them. Is it possible?
Asked
Active
Viewed 8,113 times
12
-
Here: https://stackoverflow.com/q/10965201/632951 – Pacerier Jul 21 '17 at 14:54
2 Answers
5
I tried write a C/C++ binding of shared memory access from nodejs. https://github.com/supipd/node-shm
Still work in progress (but working for me), maybe usefull, if bug or suggestion, inform me.

supipd
- 319
- 3
- 10
3
You can write a binding to C/C++. Start from http://howtonode.org/how-to-module (Writing a Binding section).
Within the binding code, you can use shared memory to your C++ service, although it may make more sense to link directly to the service if it makes sense.

Pascal Belloncle
- 11,184
- 3
- 56
- 56
-
-
I wouldn't recommend using shared memory from Node.js. Can't you have your node.js talk to your service over TCP or anything message-based ? – Floby Feb 07 '13 at 10:26
-
1@Floby: When nodejs application and c++ service are in same os is it a good idea? (using TCP) – JalalJaberi Feb 25 '13 at 21:24
-
Yes it is. TCP is portable to any platform. If you design your application this way you do not have to worry about compatibility issues. – Floby Feb 26 '13 at 08:54
-
1
-
-
1
-
1Shared memory needs to be used with extreme care. But for a large data set it is millions of times faster than TCP. – Artelius Nov 23 '19 at 02:06