01-30-2020 11:23 PM
Dear Experts,
I am sending 10 bytes of data using UDP Protocol between 2 computers and captured the data packet using Wireshark to verify the same. Namely I am sending 1 to 10 numbers and the same can be verified on Wireshark(see the attached picture, underlined in red). But just after my data I see trailing zeros(see the attached picture, underlined in green). I want to know whether is it okay about this trailing zeros or is there any way to get it fixed( I mean in such manner that after 10th byte nothing gets displayed)?
PS: I am attaching the vi I used to test the same. If you are testing between 2 computers kindly ensure to replace localhost with respective ip address in the code.
01-30-2020 11:58 PM
What is your concern here? Your VI seems to be running okay. A UDP packet contains many more bytes than just what the data payload is. I'm not sure why there are extra zeroes at the end. Perhaps the network layer had to add bytes to meet some minimum packet size. So if your application works, why are you looking at it at this label and feels these zeroes need to be "fixed"?
One thing I don't understand is why you bundle a cluster of 10 U8's into another cluster, then need to unbundle the cluster on the other end to get back to your original cluster. Interestingly, the extra cluster doesn't add any additional payload in the typecast to string. So the extra bundle on the server and unbundle on the receiver can just be eliminated.
But I'd recommend you actually use a flatten to string and unflatten to string. That will allow you to send more complicated data structures and make sure they are interpreted properly on the receiving end.
01-31-2020 09:39 AM
Wireshark confirms that the data size is 10 bytes. That's all that will come out the other side.
01-31-2020 09:48 AM
I guess we never properly addressed your question. Send a checksum of some kind and tack it onto the end of the message. Then do the calculation again at the other end and see if you get the same result.
01-31-2020 09:55 AM
@billko wrote:
I guess we never properly addressed your question. Send a checksum of some kind and tack it onto the end of the message. Then do the calculation again at the other end and see if you get the same result.
Was that the question? The subject line talked about verifying bytes, but the body of the message never talked about it.
And the checksum is built into the UDP protocol. https://en.wikipedia.org/wiki/User_Datagram_Protocol so there should be no need to do it at the application level as well.
01-31-2020 10:10 AM - edited 01-31-2020 10:11 AM
oops, i think i was wrong
01-31-2020 10:13 AM
I mean, wrong about the checksum issue.