0

It's pretty much the tittle. Im not expecting the whole code to just copy and paste (but feel free to do it). Im just having difficulties to find some data related. If someone knows how to do it, please post some hints, article links, specific words to make some research on it. Thank you.

7
  • hint: Poco library, it has all the bits you need to hook up together to do this.. Commented Jan 12, 2017 at 10:50
  • 1
    "connect with a server" = "writing a client". You are asking how to write an HTTP client in C++. And why should the client care in which language the server was written? It may be written in BASIC and you wouldn't notice. That's the point of the web and of internet protocols. Commented Jan 12, 2017 at 10:53
  • @ChristianHackl Thanks sr. Commented Jan 12, 2017 at 10:59
  • 2
    @MaicoWilliams: I cannot tell how serious you are, but there is nothing magic either about Node.js or about a C++ client. The communcation is just HTTP, probably a GET request with a response that contains a header like Content-Type: application/json. How the server is implemented must be irrelevant for the client. It's like asking "I want to plug my washing machine's cable into a type C socket. Electricity comes from a coal-fired power plant." Commented Jan 12, 2017 at 11:05
  • 1
    I'd just mention that generally I would stay away from c++ client with a Node.js server, an Apache thrift server would be better... Commented Jan 12, 2017 at 11:07

2 Answers 2

2

As Christian mentioned in his comment, your problem can be solved by implementing an HTTP client that parses JSON responses, independently of the technology used by your server. To do this in C++, I would refer you to the following resources:

If your C++ application uses a framework such as Qt, it likely includes facilities for requests (e.g. Qt HTTP example).

On the server side, you will have to define HTTP endpoints that return the data you are interested in, encoded as JSON. The beginning of this tutorial shows an easy way to do that.

Sign up to request clarification or add additional context in comments.

1 Comment

Thanks. After his answer I have found some info even by myself. This one is nice too: github.com/mrtazz/restclient-cpp
2

node.js c++ add on manual

https://nodejs.org/api/addons.html

http://libuv.org/

use libuv function in node.js 0.12.x

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.