-
Notifications
You must be signed in to change notification settings - Fork 279
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
Messages sent without MSG_EOR set end up with MSG_EOR set server side #638
Comments
You need to enable the explicit EOR marking as described in Socket API. |
Thanks for pointing that out. Enabling SCTP_EXPLICIT_EOR on both client and server, the client now gets "Connection reset by peer". Will read RFC 6458 to make sure I'm using it correctly, and then get back if needed.
|
Note that handling |
In my sample (client.c), I enable explicit EOR marking. After that the client receives SCTP_ASSOC_CHANGE with SCTP_COMM_UP. After one or two SCTP_PEER_ADDR_CHANGE the client receives SCTP_SEND_FAILED_EVENT. In the end, the server (discard_server.c) only receives 66432 bytes (from 128K sent) without MSG_EOR. What am I doing wrong? |
Do the default usrsctp examples work? |
|
Thanks for the feedback. The examples work correctly. I will try to pinpoint my problem(s) based on If I use |
No, empty messages are not possible. The end of RFC 4960, Section 6.2 reads:
That should be the case. If not, it is a bug. |
Caution: |
Indeed, I mistakenly assumed it's MSG_EOR on both client and server. Using SCTP_EOR fixes my remaining issues. Plus, a client-set SCTP_EOR is gracefully handled if only parts can be sent. Recap how to solve this issue, with the goal to send arbitrarily sized messages, using only sync/blocking calls as a bonus:
Thank you very much for your help. This issue is solved from my side. |
Use case
Sending arbitrarily big messages to the server in parts. Every part sent is smaller than the sb_free advertised to send_cb, and has flags = 0. The last message has MSG_EOR set.
Expected
The server (in receive_cb) receives all message parts in order and with flags = 0, except the last message, which has MSG_EOR set. The SSN only gets incremented after messages with MSG_EOR set.
Observed
Individual message parts arrive with MSG_EOR set, and the SSN is incremented for every message part the server receives.
Platform
I can reproduce this on macOS 11.5.2 (big sur), xcode 12.5.
Notes
See sample code forked from master here: https://github.com/dirkz/usrsctp/blob/arbitrary_size/programs/client.c.
Sample output:
Client:
Server:
Unchanged from the current master. Same behavior with the discard server.
The text was updated successfully, but these errors were encountered: