Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

peek methods for UnixDatagram and UnixStream? #68565

Closed
joshtriplett opened this issue Jan 27, 2020 · 1 comment · Fixed by #73761
Closed

peek methods for UnixDatagram and UnixStream? #68565

joshtriplett opened this issue Jan 27, 2020 · 1 comment · Fixed by #73761
Labels
C-feature-request Category: A feature request, i.e: not implemented / a PR. T-libs-api Relevant to the library API team, which will review and decide on the PR/issue.

Comments

@joshtriplett
Copy link
Member

joshtriplett commented Jan 27, 2020

#38980 added peek and peek_from methods for UdpSocket, and added peek to TcpStream.

Would it be possible to add the peek and peek_from methods to UnixDatagram as well, and to add the peek method to UnixStream?

I would also be interested in having a Linux extension method for UnixDatagram that calls recv with MSG_PEEK | MSG_TRUNC, to block until the next packet is available and return the length of that packet. Perhaps next_packet_len()? (Doing that is possible on some other platforms via different methods, but some platforms can't do it at all without just reading and buffering the pending packet via MSG_PEEK with increasingly large buffers.)

@jonas-schievink jonas-schievink added C-feature-request Category: A feature request, i.e: not implemented / a PR. T-libs-api Relevant to the library API team, which will review and decide on the PR/issue. labels Jan 27, 2020
@rijenkii
Copy link
Contributor

Just FYI - socket2::Socket has a peek method, and can be constructed with the help of From<UnixStream>, From<UnixDatagram> and From<UnixListener>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-feature-request Category: A feature request, i.e: not implemented / a PR. T-libs-api Relevant to the library API team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants