You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I can use peek on a TCPStream to see how many bytes are available to read. I use this to avoid blocking when calling read.
With UDPSocket, there doesn't seem to be a way to avoid blocking when using recv_from to read data into a buffer. I want something that either reads a UDP packet or immediately returns. Does this exist?
EDIT: recv and recv_from seem to be exactly the same. recv uses recv_from in its example.
@matthewrobertbell we most definitely want to implement peek as it also exists in std::net::UdpSocket, but we've been blocked on the mio 0.7 release for this. Once it's released we'll upgrade, and implement the method accordingly.
Activity
matthewrobertbell commentedon Nov 29, 2019
It seems like mio has
peek/peek_fromon UDPStream in master (0.7), but not in 0.6 which async-std uses. Link: https://tokio-rs.github.io/mio/doc/mio/net/struct.UdpSocket.html#method.peek_fromIt was added here: tokio-rs/mio@2f688de
I am new to async-std, how would I go about updating mio or otherwise adding these methods? Are there stability guarantees that would affect this?
[-]Peeking a UDPStream?[/-][+]Peeking a UDPSocket?[/+]matthewrobertbell commentedon Nov 29, 2019
It would also seem useful to either implement
StreamforUdpSocket, or create aUdpStream, where each Item in the stream is a UDP packet.yoshuawuyts commentedon Dec 12, 2019
@matthewrobertbell we most definitely want to implement
peekas it also exists instd::net::UdpSocket, but we've been blocked on the mio 0.7 release for this. Once it's released we'll upgrade, and implement the method accordingly.