R
R
rinoh2018-08-18 22:08:09
Rust
rinoh, 2018-08-18 22:08:09

Who can explain the difference between hyper and Tokio in Rust?

I am newbie. Interested in Rust. Learned about hyper and Tokio. Hyper'a says that this is an implementation of HTTP, and Tokio for the network code. From my point of view, I can't figure out what the difference is. You can also write a server on hyper (well, I kind of understood this), and it’s also written about the implementation of the client. What is it? This is not the client-side, which is usually written in JavaScript.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
L
lo-fi, 2018-08-18
@rinoh

HTTP is a protocol. Tokio is a library for writing network code of any kind. But Tokio can't parse HTTP. To do this, there is Hyper - a library for writing HTTP servers and clients. The HTTP server on Hyper will use Tokio to work with connections, and Hyper will already parse HTTP.
The client-server model obviously has a client and a server. An HTTP client is still the same socket, only it is no longer a server one. Therefore, here Hyper can create requests and parse responses. And also, perhaps, to interact with the network using Tokio.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question