Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Network programming. Determine end of message

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?

like image 234
ManuelSchneid3r Avatar asked Jan 31 '26 16:01

ManuelSchneid3r


1 Answers

I am not sure that TCP/IP connections are exchanging well delimited messages. Routers could fragment packets. (So cmsg_header could be unreliable).

All TCP/IP based protocols I know about (HTTP, SMTP, X11, RPCXDR) are handling message organization at the application level. Your application library need to know somehow when and when a "message" starts or ends.

like image 134
Basile Starynkevitch Avatar answered Feb 02 '26 05:02

Basile Starynkevitch



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!