Reputation: 14879
My appliactions sends through the wire using socket small messages. Each message is around 200 bytes of data. I would like to see my data sent in 2 frames instead of 1. My questions are
I am using Linux and C.
Upvotes: 3
Views: 1078
Reputation: 8943
Here are a few things you can consider.
Upvotes: 0
Reputation: 56549
How to do that i.e. is there a way to cause TCP to automatically split the buffer in 2 frames?
TCP is a stream communication protocol, all data is continuous. You should split your data by delimiters.
For example, in HTTP protocol each separated request is splited by two \n
.
Do I get the same if I send my buffer in 2 separate writes?
No, you will receive them as a one continuous data stream. Frames are meaningless.
Note: Before you receive any data TCP in your application, packets are separated but OS collect and reassemble them. This process is transparent from your application.
Upvotes: 5