-1

I made a simple server in nodejs. I want is to connect to the server from other application (app is in c++) on rasppserypi. I'm making connection and sending dataString from raspberry to node server.

So there is my question: How can i "catch" data that raspberry is sending to server?

Dr.Glob
  • 21
  • 4

1 Answers1

1

You can use multiple options:

  1. Make a simple http server. Express is one of the most used modules for http servers in node.js. It is fast to setup and easy to use. http://expressjs.com/en/starter/hello-world.html Boost would be easy to use for the c++ part. How to send http request and retrieve a json response C++ Boost

  2. Make a tcp connection between them both. You can also easily make a tcp connection between them both. Use Boost for the c++ part and the internal net module of node.js https://gist.github.com/tedmiston/5935757

  3. Use node.js on the raspberrypi as well. You can also run node.js from the raspberrypi and make the client server communication like in the snippet above. From node.js you can call your c++ program as a child process.

  4. There are many other options but this should be the easiest ones. It also depends on your actual use case, what you want to build.

Community
  • 1
  • 1
user934801
  • 1,119
  • 1
  • 12
  • 30