Skip to content

Investigate and document UDP recv/peek(_from) behavior on *nix when using a smaller buffer. #1174

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

Closed
dtacalau opened this issue Nov 27, 2019 · 4 comments · Fixed by #1530
Closed
Milestone

Comments

@dtacalau
Copy link
Contributor

On Windows, if the data is larger than the buffer specified, the buffer is filled with the first part of the data, and recv/peek(_from) returns the error WSAEMSGSIZE(10040). The excess data is lost.

What does *nix do?

Ref PR https://github.com/tokio-rs/mio/pull/1167/files#diff-c022871452a328dc8c9cd10130eb1572R233

@andrewtj
Copy link

In case you haven't seen it rust-lang/rust#55794 concerns the different behaviour of Windows and *nix. For my $0.02, it'd be better to make both platforms behave the same, probably by returning an error on truncation.

@Thomasdezeeuw
Copy link
Collaborator

Pr #1167 adds documentation to explain the difference in behaviour. And once rust-lang/rust#55794 is resolved we'll follow that approach. So I'm punting this to v1.

@Thomasdezeeuw Thomasdezeeuw added this to the v1.0 milestone Nov 28, 2019
@Thomasdezeeuw
Copy link
Collaborator

This would be solved if we switch to socket2 (tracked in #1381) which has a struct RecvFlags to aid in this.

@Thomasdezeeuw Thomasdezeeuw modified the milestones: v1.0, V0.8 Jan 5, 2021
@Thomasdezeeuw
Copy link
Collaborator

This might depend on rust-lang/socket2#188.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants