I'm implementing a simple messaging protocol over TCP at the moment. I want immediate message delivery and that's about it.
I've tried using DataChunker for this, but it buffers messages (two of them at the moment). It could be made to not buffer messages by surrounding a message with sync sequences, but it seems to me that this would be veering of from the components original purpose? Framer is the next obvious candidate, but I'm not sure I like the API. Specifically Framer seems to be meant for unreliable connections and therefore it supports sequence numbers in the form of tags. But I don't need that so I end up introducing an extra component to my protocol stack just to add a dummy tag to my payload. What I really want is a dead simple framing protocol that simply prefixes the message with a 16-bit number (or 32-bit number) that indicates the number of bytes that follow. I'm new to Python so I'm not quite sure how to go about this though. I wrote a proof-of-concept by using struct.pack(), but I'm not sure how to calculate the message length properly. E.g. if the message type is a unicode string len() will give me number of characters rather than the length of the string in bytes, correct? So any pointers before I go and implement my framing component properly? -- ! Lauri --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "kamaelia" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/kamaelia?hl=en -~----------~----~----~----~------~----~------~--~---
