On 2015-04-19 22:45, Jonathan Wilkes via Pd-list wrote:
On 04/19/2015 03:46 PM, IOhannes m zmölnig wrote:
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.
any packetizing token ('"tail" bytes') needs to be excluded from or within from the actual payload.
I wonder if localhost is doing optimizations that make the problem unlikely to happen.
do not trust it. much broken multithreaded code used to work fine on single-core machines, because the single-threaded architecture made some problems unlikely to happen. and then we got multiple cores... (admittedly, this story is entirely made up by me; but there is no reason why it should not not true)
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.
if you "can easily lose data" over your TCP/IP connection then something is seriously wrong with your setup.
(but anyhow, i don't know the actual problem you are working on, and i assumed that it is about your gui-rewrite. i'm nitpicky to make you avoid putting too much (== any) code depending on node.js features into the Pd-core side. but you are most likely aware of that anyhow)
fgmasdr IOhannes