TCP/IP Framing Protocol

If you have stream protocol of data how do you know when a item starts and when it is finished?

This is problem that every TCP/IP protocol needs to solve.

How do we know a data item like say an HL7 message with lab data starts and ends? Or a request for a web page or the results of requesting a web page?

One example of framing protocol is the lower layer protocol used for HL7.

Another example is the HTTP protocol used for the world wide web.