I am using a POSIX OS (vxWorks) and want to understand how to process TCP data. I understand in UDP everything is really up to you and TCP is a lot more managed underneath.
Suppose a remote socket I am connected to promises to send me JSON data. The documentation simply says, once established, we will send you JSON data.
Using the function recv
on the TCP socket, and assuming I give it a buffer of an extreme size, should I expect that I would always get perfectly assembled JSON data even though the message may be sent in multiple chunks on the interface layer, or do I need to essentially parse each buffer of data I received until I think I have a fully formed JSON message?
TCP has no idea about application messages. You need to implement the protocol layered on top of TCP to find message boundaries, if your protocol has one.