Tokio-Core TCP example

Hi guys,
I am quite new to rust did my first footsteps and wanted to go further and try some asynchronous programming. As you might expect from the title, I look tokio-core up. I read about futures, mio etc to understand the basics but right now I'm stuck and need help. I hope you guys can give me a good hint how to proceed:

I started with the echo server example but I dont know where to go from there. I dont want to just copy input output as in the echo server. Primarly I want to access the reader to recieve some data which can be logged, stored in a database etc.

Here: in line 90 how do I access the reader variable to achive my goal?
https://github.com/tokio-rs/tokio-core/blob/master/examples/echo.rs

I probably need a good advice, example or a nudge in the right direction.

Thank you very much

Ben

This example uses raw sockets, so this is quite low level. The reader is a ReadHalf that implements the Read trait so you can read directly from it, but any time it blocks you will have to handle the WouldBlock error yourself.

What do you want to read from the socket? In general I would suggest to use a Framed with a Codec, I find that easier to work with than raw sockets. But again that depends on what your use case is :slightly_smiling_face: