Prev: Compiling 64-bit Tcl/Tk8.4.19 with Sun Studio 12.1 Failed due to syntax error!!
Next: tclkit string size limit?
From: Jan Kandziora on 22 Jul 2010 13:57 Hi, for passing arbitrary structured data through a network protocol, I'd like to use binary format/binary scan. My idea is to pass the format, then the binary blob through the channel, e.g. "c3Ic10I4\0<binary string>". No problem in generating this. The problem is when the other side parses the format "c3Ic10I4". How to know in advance how many variables are needed? Is there some code snippet out there which does the trick? Kind regards Jan
From: Uwe Klein on 22 Jul 2010 14:42 Jan Kandziora wrote: > Hi, > > for passing arbitrary structured data through a network protocol, I'd like > to use binary format/binary scan. My idea is to pass the format, then the > binary blob through the channel, e.g. "c3Ic10I4\0<binary string>". No > problem in generating this. > > The problem is when the other side parses the format "c3Ic10I4". How to know > in advance how many variables are needed? Is there some code snippet out > there which does the trick? > > Kind regards > > Jan > > what about: "4:c3Ic10I4\0<binary string>" ( or some other arrangement that transmits the itemcount too ) another solution is to remove all length specifier elements from the string and than count the remaining length: c3Ic10I4 cIcI string length cIcI 4 uwe
From: dave.joubert on 23 Jul 2010 08:19 On Jul 22, 6:57 pm, Jan Kandziora <j...(a)gmx.de> wrote: > Hi, > > for passing arbitrary structured data through a network protocol, I'd like > to use binary format/binary scan. My idea is to pass the format, then the > binary blob through the channel, e.g. "c3Ic10I4\0<binary string>". No > problem in generating this. > > The problem is when the other side parses the format "c3Ic10I4". How to know > in advance how many variables are needed? Is there some code snippet out > there which does the trick? > > Kind regards > > Jan If you still have a choice, you may want to use OSC as a protocol instead of of rolling your own. OSC has solved all these problems and in addition supports concepts such as bundles and arrays. Another benefit is that that you will automatically gain access to other apps that are not written in Tcl. I have a library somewhere that separates the packing / unpacking from actual network transmission, and it includes some test clients / servers. Dave
From: Neil on 23 Jul 2010 09:11 > another solution is to remove all length specifier elements from the > string and than count the remaining length: > c3Ic10I4 > cIcI > > string length cIcI > 4 > > uwe Provided you also remove 'u's...
From: Uwe Klein on 23 Jul 2010 10:16
Neil wrote: >>another solution is to remove all length specifier elements from the >>string and than count the remaining length: >>c3Ic10I4 >>cIcI >> >>string length cIcI >>4 >> >>uwe > > > Provided you also remove 'u's... he, I don't do newfangled options ;-) uwe |