What is the equivalent of Tokio 0.1's UdpFramed in 0.2 and 0.3?

I would like to wrap up a UdpSocket with a decoder/encoder, but UdpFramed doesn't seem to exist in Tokio 0.2 or 0.3. There is Framed in tokio_util::codec, but it requires the underlying object to implement the AsyncRead and AsyncWrite traits, which UdpSocket doesn't.

How should this codec pattern be applied to a UdpSocket in the more recent versions of Tokio?

For Tokio 0.2, you can use the UdpFramed type from tokio-util. I know there's a PR to bring it back in 0.3, from which it was temporarily removed due to some API changes in the underlying UdpSocket.

1 Like

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.