2

I want to create a system is like below:

Client will send requests to server.

Server receive requests and download the request file from cloud asynchronously.That means server will just receive requests and then download these requests by some library.

Library will notify server when the download is finished, then server will notify client the download is finished.

Is there any library like that in linux c? curl_multi_* is non-blocking, so I need to poll the curl_multi_perform everytime so it's not an ideal asynchronous library for me. thx

0

There are many available options. If you are ready to write low-level code and control every aspect of communication and protocol, then one of them is libuv. As per their description, features are:

  • Full-featured event loop backed by epoll, kqueue, IOCP, event ports.
  • Asynchronous TCP and UDP sockets
  • Asynchronous DNS resolution
  • Asynchronous file and file system operations
  • File system events
  • ANSI escape code controlled TTY
  • IPC with socket sharing, using Unix domain sockets or named pipes (Windows)
  • Child processes
  • Thread pool
  • Signal handling
  • High resolution clock
  • Threading and synchronization primitives

Also, you could look at libevent. List of features mostly duplicate libuv.

However, if you are not limited to C programming language, I would recommend you to try gRPC. It is easy to use and abstracts away many error-prone places in your code.

| improve this answer | |
  • I use libevent and libcurl, and try to use curl_multi_* to do asynchronous, any suggestion? thx – code_worker Apr 25 '17 at 10:54
  • If you have any specific questions on how to use these libraries, the best place to ask such questions is stackoverflow – tysonite Apr 25 '17 at 11:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.