Skip to content

How to keep the header and body of http request in same tcp segment in .net 4.5? #74304

Answered by MihaZupan
yll690 asked this question in Q&A
Discussion options

You must be logged in to vote

This is really fragile behavior for the server to rely on.
If you can't upgrade to .NET 6, you can consider putting a reverse proxy between your client and server. The client will still send the request in multiple TCP segments, but the proxy can buffer them for you.

With YARP for example, you would get the same behavior as if you had upgraded the client to 6.0.
We will send up to 4 KB of headers+content down to the Socket in 1 call, but there is no guarantee of how that will be split up on the transport layer. If your headers+content are always small, odds are they will be grouped together.

Replies: 5 comments 4 replies

Comment options

You must be logged in to vote
1 reply
@yll690
Comment options

Comment options

You must be logged in to vote
1 reply
@rzikm
Comment options

rzikm Aug 22, 2022
Collaborator

Comment options

You must be logged in to vote
1 reply
@yll690
Comment options

Answer selected by yll690
Comment options

You must be logged in to vote
1 reply
@yll690
Comment options

Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
5 participants