003 File Manager
Current Path:
/usr/local/share/examples/curl
usr
/
local
/
share
/
examples
/
curl
/
📁
..
📄
10-at-a-time.c
(4.24 KB)
📄
Makefile.example
(1.86 KB)
📄
README.md
(1.35 KB)
📄
altsvc.c
(1.83 KB)
📄
anyauthput.c
(4.82 KB)
📄
cacertinmem.c
(7.14 KB)
📄
certinfo.c
(2.25 KB)
📄
chkspeed.c
(6.54 KB)
📄
cookie_interface.c
(4.03 KB)
📄
crawler.c
(6.53 KB)
📄
curlgtk.c
(2.94 KB)
📄
curlx.c
(16.41 KB)
📄
debug.c
(4.21 KB)
📄
ephiperfifo.c
(14.49 KB)
📄
evhiperfifo.c
(11.9 KB)
📄
externalsocket.c
(4.83 KB)
📄
fileupload.c
(2.78 KB)
📄
fopen.c
(13.87 KB)
📄
ftp-wildcard.c
(4.15 KB)
📄
ftpget.c
(2.59 KB)
📄
ftpgetinfo.c
(2.86 KB)
📄
ftpgetresp.c
(2.51 KB)
📄
ftpsget.c
(2.89 KB)
📄
ftpupload.c
(4.48 KB)
📄
ftpuploadfrommem.c
(3.81 KB)
📄
ftpuploadresume.c
(4.24 KB)
📄
getinfo.c
(1.62 KB)
📄
getinmemory.c
(3.24 KB)
📄
getredirect.c
(2.3 KB)
📄
getreferrer.c
(1.81 KB)
📄
ghiper.c
(12.04 KB)
📄
hiperfifo.c
(11.97 KB)
📄
href_extractor.c
(2.61 KB)
📄
htmltidy.c
(3.88 KB)
📄
htmltitle.cpp
(6.23 KB)
📄
http-post.c
(1.99 KB)
📄
http2-download.c
(6.19 KB)
📄
http2-pushinmemory.c
(5.02 KB)
📄
http2-serverpush.c
(7.1 KB)
📄
http2-upload.c
(8.05 KB)
📄
http3-present.c
(1.53 KB)
📄
http3.c
(1.81 KB)
📄
httpcustomheader.c
(2.27 KB)
📄
httpput-postfields.c
(3.36 KB)
📄
httpput.c
(3.6 KB)
📄
https.c
(2.53 KB)
📄
imap-append.c
(3.77 KB)
📄
imap-authzid.c
(2.21 KB)
📄
imap-copy.c
(2.35 KB)
📄
imap-create.c
(2.06 KB)
📄
imap-delete.c
(2.06 KB)
📄
imap-examine.c
(2.11 KB)
📄
imap-fetch.c
(1.95 KB)
📄
imap-list.c
(2.08 KB)
📄
imap-lsub.c
(2.08 KB)
📄
imap-multi.c
(2.29 KB)
📄
imap-noop.c
(2 KB)
📄
imap-search.c
(2.35 KB)
📄
imap-ssl.c
(3.25 KB)
📄
imap-store.c
(2.69 KB)
📄
imap-tls.c
(3.5 KB)
📄
makefile.dj
(1.58 KB)
📄
multi-app.c
(3.36 KB)
📄
multi-debugcallback.c
(4.21 KB)
📄
multi-double.c
(2.62 KB)
📄
multi-event.c
(6.01 KB)
📄
multi-formadd.c
(3.23 KB)
📄
multi-legacy.c
(5.13 KB)
📄
multi-post.c
(3.04 KB)
📄
multi-single.c
(2.49 KB)
📄
multi-uv.c
(5.97 KB)
📄
multithread.c
(2.59 KB)
📄
opensslthreadlock.c
(2.69 KB)
📄
parseurl.c
(2.13 KB)
📄
persistent.c
(2.15 KB)
📄
pop3-authzid.c
(2.18 KB)
📄
pop3-dele.c
(2.15 KB)
📄
pop3-list.c
(1.93 KB)
📄
pop3-multi.c
(2.29 KB)
📄
pop3-noop.c
(2.11 KB)
📄
pop3-retr.c
(1.93 KB)
📄
pop3-ssl.c
(3.22 KB)
📄
pop3-stat.c
(2.13 KB)
📄
pop3-tls.c
(3.47 KB)
📄
pop3-top.c
(2.09 KB)
📄
pop3-uidl.c
(2.03 KB)
📄
post-callback.c
(5.15 KB)
📄
postinmemory.c
(3.36 KB)
📄
postit2-formadd.c
(3.51 KB)
📄
postit2.c
(3.41 KB)
📄
progressfunc.c
(4.8 KB)
📄
resolve.c
(1.92 KB)
📄
rtsp.c
(9.02 KB)
📄
sampleconv.c
(3.25 KB)
📄
sendrecv.c
(4.52 KB)
📄
sepheaders.c
(2.67 KB)
📄
sessioninfo.c
(3.06 KB)
📄
sftpget.c
(3.25 KB)
📄
sftpuploadresume.c
(3.82 KB)
📄
shared-connection-cache.c
(2.51 KB)
📄
simple.c
(1.68 KB)
📄
simplepost.c
(1.83 KB)
📄
simplessl.c
(4.56 KB)
📄
smooth-gtk-thread.c
(6.01 KB)
📄
smtp-authzid.c
(5.33 KB)
📄
smtp-expn.c
(2.55 KB)
📄
smtp-mail.c
(4.86 KB)
📄
smtp-mime.c
(5.47 KB)
📄
smtp-multi.c
(4.54 KB)
📄
smtp-ssl.c
(5.75 KB)
📄
smtp-tls.c
(6.21 KB)
📄
smtp-vrfy.c
(2.62 KB)
📄
sslbackend.c
(2.29 KB)
📄
synctime.c
(12.6 KB)
📄
threaded-ssl.c
(4.34 KB)
📄
url2file.c
(2.43 KB)
📄
urlapi.c
(1.98 KB)
📄
usercertinmem.c
(8.87 KB)
📄
xmlstream.c
(4.94 KB)
Editing: 10-at-a-time.c
/*************************************************************************** * _ _ ____ _ * Project ___| | | | _ \| | * / __| | | | |_) | | * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, et al. * * This software is licensed as described in the file COPYING, which * you should have received as part of this distribution. The terms * are also available at https://curl.se/docs/copyright.html. * * You may opt to use, copy, modify, merge, publish, distribute and/or sell * copies of the Software, and permit persons to whom the Software is * furnished to do so, under the terms of the COPYING file. * * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY * KIND, either express or implied. * ***************************************************************************/ /* <DESC> * Download many files in parallel, in the same thread. * </DESC> */ #include <errno.h> #include <stdlib.h> #include <string.h> #ifndef WIN32 # include <unistd.h> #endif #include <curl/curl.h> static const char *urls[] = { "https://www.microsoft.com", "https://opensource.org", "https://www.google.com", "https://www.yahoo.com", "https://www.ibm.com", "https://www.mysql.com", "https://www.oracle.com", "https://www.ripe.net", "https://www.iana.org", "https://www.amazon.com", "https://www.netcraft.com", "https://www.heise.de", "https://www.chip.de", "https://www.ca.com", "https://www.cnet.com", "https://www.mozilla.org", "https://www.cnn.com", "https://www.wikipedia.org", "https://www.dell.com", "https://www.hp.com", "https://www.cert.org", "https://www.mit.edu", "https://www.nist.gov", "https://www.ebay.com", "https://www.playstation.com", "https://www.uefa.com", "https://www.ieee.org", "https://www.apple.com", "https://www.symantec.com", "https://www.zdnet.com", "https://www.fujitsu.com/global/", "https://www.supermicro.com", "https://www.hotmail.com", "https://www.ietf.org", "https://www.bbc.co.uk", "https://news.google.com", "https://www.foxnews.com", "https://www.msn.com", "https://www.wired.com", "https://www.sky.com", "https://www.usatoday.com", "https://www.cbs.com", "https://www.nbc.com/", "https://slashdot.org", "https://www.informationweek.com", "https://apache.org", "https://www.un.org", }; #define MAX_PARALLEL 10 /* number of simultaneous transfers */ #define NUM_URLS sizeof(urls)/sizeof(char *) static size_t write_cb(char *data, size_t n, size_t l, void *userp) { /* take care of the data here, ignored in this example */ (void)data; (void)userp; return n*l; } static void add_transfer(CURLM *cm, int i) { CURL *eh = curl_easy_init(); curl_easy_setopt(eh, CURLOPT_WRITEFUNCTION, write_cb); curl_easy_setopt(eh, CURLOPT_URL, urls[i]); curl_easy_setopt(eh, CURLOPT_PRIVATE, urls[i]); curl_multi_add_handle(cm, eh); } int main(void) { CURLM *cm; CURLMsg *msg; unsigned int transfers = 0; int msgs_left = -1; int still_alive = 1; curl_global_init(CURL_GLOBAL_ALL); cm = curl_multi_init(); /* Limit the amount of simultaneous connections curl should allow: */ curl_multi_setopt(cm, CURLMOPT_MAXCONNECTS, (long)MAX_PARALLEL); for(transfers = 0; transfers < MAX_PARALLEL; transfers++) add_transfer(cm, transfers); do { curl_multi_perform(cm, &still_alive); while((msg = curl_multi_info_read(cm, &msgs_left))) { if(msg->msg == CURLMSG_DONE) { char *url; CURL *e = msg->easy_handle; curl_easy_getinfo(msg->easy_handle, CURLINFO_PRIVATE, &url); fprintf(stderr, "R: %d - %s <%s>\n", msg->data.result, curl_easy_strerror(msg->data.result), url); curl_multi_remove_handle(cm, e); curl_easy_cleanup(e); } else { fprintf(stderr, "E: CURLMsg (%d)\n", msg->msg); } if(transfers < NUM_URLS) add_transfer(cm, transfers++); } if(still_alive) curl_multi_wait(cm, NULL, 0, 1000, NULL); } while(still_alive || (transfers < NUM_URLS)); curl_multi_cleanup(cm); curl_global_cleanup(); return EXIT_SUCCESS; }
Upload File
Create Folder