Linux buffers all received messages received on a socket. But before receiving, this messages had a beginning and an end. Linux writes this messages sequentially in the buffer, loosing therefore the information of the end of the message.
I know that in Linux I could use cmsg_header.But Windows does not offer send-/recvmsg() procedures. How do I determine the end of a message on the buffer platformagnostic?
A network facing application typically has a clear transport/business logic separation.
Business layer operates whole messages only. Transport is delivering whole messages to the upstream business layer potentially assembling continuous stream from fragments, re-slicing, and re-interpreting it as a series of messages.
Transport layer is typically communicating with the remote transport layer using protocol messages of form [size(length=S)][payload(variable length)]. Where [size] is a single number whose marshalled length S is known to all communicating parties.
The first thing the transport layer does is it waits to receive S bytes from the downstream (either asynchronously or synchronously, does not matter) into a temporary buffer. Once done it unmarshals received data and becomes aware of the length of the payload to be received L.
Once the lenght of the payload L is known transport is waiting to receive L bytes from the downstream into a temporary buffer (may have to combine multiple reads) and once done it notifies application layer passing it the whole assembled message in a single buffer.