本文介绍了libcurl中是否有可用的压缩的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要使用libcurl和C ++将一个庞大的文件从本地机器传输到远程机器。有没有任何压缩选项可用内置libcurl。由于要传输的数据量很大(大小为100 MB到1 GB),因此如果我们在libcurl本身中有任何这样的选项会更好。我知道我们可以压缩数据并通过libcurl发送它。但只是想知道是否有任何更好的方式这样做。

I need to transfer a huge file from local machine to remote machine using libcurl with C++. Is there any compression option available in-built with libcurl. As the data to be transferred is large (100 MB to 1 GB in size), it would be better if we have any such options available in libcurl itself. I know we can compress the data and send it via libcurl. But just want to know is there any better way of doing so.

注意:在我的情况下,许多客户端计算机会定期将这样大量的数据传输到远程服务器。

Note: In my case, many client machines transfer such huge data to remote server at regular interval of time.

thanks,
Prabu

thanks,Prabu

推荐答案

根据和选项 CURLOPT_ENCODING ,您可以指定:

According to curl_setopt() and options CURLOPT_ENCODING, you may specify:

是一些示例(只需在您的浏览器中点击搜索,然后键入 compression ),但我不知道热完全是否工作,以及它是否期望已经gzip压缩的数据。

Here are some examples (just hit search in your browser and type in compression), but I don't know hot exactly does it work and whether it expect already gzipped data.

a href =http://php.net/manual/en/function.gzcompress.php =nofollow> gzcompress() 并发送压缩块自己(我将这样做任务...你将更好地控制实际发生了什么,你将能够改变使用的算法)。

You still may use gzcompress() and send compressed chunks on your own (and I would do the task this way... you'll have better control on what's actually going on and you'll be able to change used algorithms).

这篇关于libcurl中是否有可用的压缩的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-22 08:01