Using CPR library for asynchronous http post request

Hello folks,
I am using a cpr lib for making a post request to the REST endpoint. I am sending some data as well as 3 images. It's taking a long time to send the images. Can anyone please suggest with a code for post request in C++
Erm, isn't C++ already written in C++?
https://whoshuu.github.io/cpr/introduction.html

Substituting one blob of C++ code with another blob of C++ code isn't going to suddenly magic a 10x improvement in performance.

> It's taking a long time to send the images.
Compared to what?

As a reference, upload an image to a file hosting site, and see how long it takes.
That's your benchmark.

https://en.wikipedia.org/wiki/Asymmetric_digital_subscriber_line
Remember, if you're sat at home like the rest of us, chances are you're sitting on the end of an ADSL line.
Meaning your upload speed is around 10x worse than your download speed.
You may have fetched the images in a blink, but sending them out again is going to take a while.
you are probably stuck. remote apis have a fixed interface and you send your request to them in that format. Assuming you have a library to make the post request, and assuming you compiled your c++ in optimized and not debug mode, it seems likely that the limitation here is bandwidth. That leaves you with a few choices... you can reduce the image -- decrease its height and width, and send a smaller amount of data works wonders. Most people today have forgotten (or never knew) about images.... images used to rarely exceed 1000x1000 pixels and that was the large ones; today triple that is not unheard of and its squared... 3000x3000 is a lot bigger than 1000x1000... you can also see if you can use a higher compression if using a compressed format like jpg, increase the level. All these ideas damage the image, though. If you need exactly the file you were sending, it won't help.

Last edited on
Topic archived. No new replies allowed.