Imported from previous forum
Hi
I am receiving UDP packet in following manner
|frame size(1)|msg(1)|frame size2|msg(2)|…|frame size(i)|msg(i)|
=================================================================
UDP PACKET N
How to identify frame length so that I can find size of msg(1)…consequently of msg(2)…msg(3)…
Frame size usually the first byte but it can be up to 4 bytes of uncompressed data received.How to identify when it’s more than 1 byte?
Thanks
Himanshu
[ original email was from janaka Sooriyaarachchi - janakas@millenniumit.com ]
frame size also a integer value, So you can use integer encoding/ decoding method to resolve the value and you can identify the field termination by stop bit.
Hi
I am receiving UDP packet in following manner
|frame size(1)|msg(1)|frame size2|msg(2)|…|frame size(i)|msg(i)|
=================================================================
UDP PACKET NHow to identify frame length so that I can find size of msg(1)…consequently of msg(2)…msg(3)…
Frame size usually the first byte but it can be up to 4 bytes of uncompressed data received.How to identify when it’s more than 1 byte?
Thanks
Himanshu
Hi Janaka
Binary feeds received have following value in first four bytes.
What will be stop bit here to find message length here ?
case 1.
Uncompressed binary data received
F1 DE 00 83
11110001 11011110 00000000 10000011
Removing first bit and converting to integer value
1110001 11011110 - 0000011
Integer Value
113 94 3
Case 2
Uncompressed binary data received
01 8B DE 00
00000001 10001011 11011110 00000000
Removing first bit and converting to integer value
-
0001011 1011110 -
Integer Value
-
11 94 -
frame size also a integer value, So you can use integer encoding/ decoding method to resolve the value and you can identify the field termination by stop bit.
Hi
I am receiving UDP packet in following manner
|frame size(1)|msg(1)|frame size2|msg(2)|…|frame size(i)|msg(i)|
=================================================================
UDP PACKET NHow to identify frame length so that I can find size of msg(1)…consequently of msg(2)…msg(3)…
Frame size usually the first byte but it can be up to 4 bytes of uncompressed data received.How to identify when it’s more than 1 byte?
Thanks
Himanshu
[ original email was from janaka Sooriyaarachchi - janakas@millenniumit.com ]
Hi,
In the Case 1,
Very first bit also have a stop bit.
So your message length is 113. That contains in a single byte
But in case 2,
you need to take 2 bytes,
00000001 10001011
After removing stop bits,
0000001 0001011
Then convert that value to decimal
00000010001011 = 139
now your message length is 139.
Hi Janaka
Binary feeds received have following value in first four bytes.
What will be stop bit here to find message length here ?case 1.
Uncompressed binary data received
F1 DE 00 83
11110001 11011110 00000000 10000011Removing first bit and converting to integer value
1110001 11011110 - 0000011
Integer Value
113 94 3
Case 2
Uncompressed binary data received
01 8B DE 00
00000001 10001011 11011110 00000000Removing first bit and converting to integer value
0001011 1011110 -Integer Value
11 94 -frame size also a integer value, So you can use integer encoding/ decoding method to resolve the value and you can identify the field termination by stop bit.
Hi
I am receiving UDP packet in following manner
|frame size(1)|msg(1)|frame size2|msg(2)|…|frame size(i)|msg(i)|
=================================================================
UDP PACKET NHow to identify frame length so that I can find size of msg(1)…consequently of msg(2)…msg(3)…
Frame size usually the first byte but it can be up to 4 bytes of uncompressed data received.How to identify when it’s more than 1 byte?
Thanks
Himanshu
It’s working now…
Thanks Janaka for valuable help…![]()
Hi,
In the Case 1,
Very first bit also have a stop bit.
So your message length is 113. That contains in a single byteBut in case 2,
you need to take 2 bytes,00000001 10001011
After removing stop bits,
0000001 0001011Then convert that value to decimal
00000010001011 = 139now your message length is 139.
Hi Janaka
Binary feeds received have following value in first four bytes.
What will be stop bit here to find message length here ?case 1.
Uncompressed binary data received
F1 DE 00 83
11110001 11011110 00000000 10000011Removing first bit and converting to integer value
1110001 11011110 - 0000011
Integer Value
113 94 3
Case 2
Uncompressed binary data received
01 8B DE 00
00000001 10001011 11011110 00000000Removing first bit and converting to integer value
0001011 1011110 -Integer Value
11 94 -frame size also a integer value, So you can use integer encoding/ decoding method to resolve the value and you can identify the field termination by stop bit.
Hi
I am receiving UDP packet in following manner
|frame size(1)|msg(1)|frame size2|msg(2)|…|frame size(i)|msg(i)|
=================================================================
UDP PACKET NHow to identify frame length so that I can find size of msg(1)…consequently of msg(2)…msg(3)…
Frame size usually the first byte but it can be up to 4 bytes of uncompressed data received.How to identify when it’s more than 1 byte?
Thanks
Himanshu