Hacker News new | past | comments | ask | show | jobs | submit login

A big advantage of LF-delimited over length-prefixed messages is netcat/telnet-friendliness. That was more valuable to us than being binary-clean as our use cases do not involve sending large binary messages.



I think you might want to make a distinction between a stream packet and a completed message.

If you're going for telnet compatibility then you'll want to terminate packets in CR+LF, but possibly expect to see only CR or LF from the client (ASCII mode).

Your stream could either be stateful (a message is always sent complete and in order, even if it takes multiple stream packets) or stateless* (different messages might have stream packets consecutively).

It would be more future proof if you started with a message grammar and then defined your protocol on top of that.


A binary-friendly client would be a hundred lines of code at most, versus inefficiency for a pretty standard protocol use-case forever.


You know you could have a length-prefix and a new-line. Best of both worlds.




Consider applying for YC's Spring batch! Applications are open till Feb 11.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: