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

Receive Packet Length of 8192 is undocumented, inconsistent (?) #642

Open
jspc opened this issue Jun 25, 2024 · 3 comments
Open

Receive Packet Length of 8192 is undocumented, inconsistent (?) #642

jspc opened this issue Jun 25, 2024 · 3 comments

Comments

@jspc
Copy link

jspc commented Jun 25, 2024

Your environment.

  • Version: Release or SHA
  • Browser: include version
  • Other Information - stacktraces, related issues, suggestions how to fix, links for us to have context

What did you do?

A working example of what I'm trying to do is in this gist

I have some potentially large payloads I want to be able to transmit with this package. I say potentially, because the payloads are unbounded.

The way I've done this is via a pretty naive fragmenter; since the maximum datagram size is 64k and we have tls overheads, split the data in chunks of slighty-smaller-than-64k, and send them on. The server side of this, as implemented with this package, works fine; I've verified this with wireshark as I was trying to debug this issue.

The problem is when I come to receive the data, also with this package. Setting a buffer of slighty-smaller-than-64k returns an io.EOF. Not a subset of data, but an EOF. Through trial and error I figured out that I was able to roughly read 8k at a time. Anything larger and I get nothing.

I found this in the repo, which looks precisely like what I'm hitting.

I guess, then, what I'm asking is:

  1. Does that 8k come from somewhere specific? I'm more than happy to be told I don't know anything about networking and that 8k is a magic number than can't be tweaked
  2. If not, should it be made a var and settable in code? Perhaps via the dtls.Config struct?
  3. If not, then should the maximum size we can send be set to 8k too?

I'm also, again, more than happy to be told I'm using the package wrong and that there's a smarter way for fragmenting data.

What did you expect?

To be able to receive packets of more than 8k, or for this to be documented somewhere.

Or, if it is documented, perhaps either clearer, or for the server to enforce the same limit.

What happened?

I was unable to, and in fact received an io.EOF instead.

@Sean-Der
Copy link
Member

Hey @jspc, sorry this took so long to respond!

1.) pion/webrtc@7026a02 is the first time I found it. I don't remember why this was chosen. I did some googling and found this

2.) 100%! You interested in making a PR? I can help!

3.) Lets make it configurable!

@jspc
Copy link
Author

jspc commented Jul 11, 2024

Hey @Sean-Der

  1. Perfect, good spot!
  2. Yep, no worries- I'll pick that up over the weekend
  3. Perfect, just what I was thinking. I'll make both sending and receiving take the same value from dtls.Config but I'll set it to respect the current values for compatibility

@Sean-Der
Copy link
Member

Hey @jspc you still interested in this issue? Anything I can do to help

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

No branches or pull requests

2 participants