On 04/19/2015 03:46 PM, IOhannes m zmölnig wrote:
On 04/19/2015 06:55 PM, Jonathan Wilkes via Pd-list wrote:
Hi list,
     Can utf8 data for a single utf8 character get split across a tcp
buffer?

>From what I understand the answer must be yes, and I should check for
incomplete utf8 data on the GUI at the end of the buffer. However I'm
not doing that atm, and I can't trigger any errors (like copy pasting
500 messages with a utf8 snowman in them).  I get perfect snowmen every
time.
since TCP/IP is totally packet agnostic, thou shalt not rely on it's
packetizing capabilities.
if your receiver emits packets the same as you sent them, then you were
merely lucky.

Thanks.  There's a string-decoder lib that puts a buffer's extra "tail" bytes
in a separate bin so they can be prepended to the next buffer.  That sounds like
the way to go.

I wonder if localhost is doing optimizations that make the problem unlikely to happen.


with TCP/IP you need a application-layer packetizing mechanism,
in FUDI this is the famous ";".

Right, but one can easily lose data before that part of the algorithm happens.  Node's Buffer API makes this extremely easy to do.  The string-decoder lib makes it easy to remedy, though.

-Jonathan

iirc, in more popular protocols (like HTTP, SMTP, FTP) it is usually CRLF.


gfmasrd
IOhannes



_______________________________________________
Pd-list@lists.iem.at mailing list
UNSUBSCRIBE and account-management -> http://lists.puredata.info/listinfo/pd-list