Counting Bytes

Is there a particular node which will tell me how may bytes a string is made up of? Im sure ive seen this somewhere before but cant remember where!

do you mean Length (String) ?

I Probably should have said packet size, as in if i have a spread of sevral strings and outputted them via udp, how do i work out what the packet size will be depending on the length of the string.
The length node looks hand, another one to remember.


Just multiply length (String) with 8. Which is 8 bits for a char, which is ANSI encoded (UTF-8 is 16bit a char).
I figured out that max UDP size is 65536 (256*256). Over this size UDP will stop sending/recieving. So, you have to split your string in this case and send as a spreaded string.

Hi Frank,thanks for that, looks like ill have toi figure things out manually with good old maths ;-). Basically al iam trying to do is pad out my udp packets to 512 bytes. I have to send 5 packes of data contrived from a string which will be under 512 butes and then pad the rest out with hex zeros.



@frank: have you read my remarks in that old video streaming thread?

the output of the length node is in bytes. the max udp-size of ~64k is also in bytes. therefore no need to multiply by 8 or 16 to compare.

@digipic: please also read above mentioned remarks. regarding sending packets via udp.

do you have a good reason to pad out your packets to 512bytes? as mentioned there, sending packets of 1472bytes would be the best thing you can do, if you have a standard mtu-size of 1500bytes.

joreg: Oh yes, sometimes old stuff is burned into brain and its hard to get it off.

Wow, theres allot of reading to do, ill have a look at these threads today. Ideally we would send packet of data of around 2300 but the memory on the chip which is reading it cant accept this so we are splitting down the data in to more manageable chunks.


@frank - just to add my 0.02c: max udp size is reported to be not 64KB, but 64 KB, minus the UDP header size (8 bytes) and the IP header size (20 bytes for IPv4 or 40 bytes for IPv6 headers).

@padding - what was the exact reason for padding instead of using separator characters? while sending shorter strings might not be faster on the udp layer (as it will always fill up one MTU block), its obviously faster in vvvv to process shorter strings.