LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Verifying bytes passed using UDP

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.

Diaspora_0-1580448023096.png

Download All
0 Kudos
Message 1 of 7
(3,284 Views)

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.

 

0 Kudos
Message 2 of 7
(3,269 Views)

Wireshark confirms that the data size is 10 bytes.  That's all that will come out the other side.

Bill
CLD
(Mid-Level minion.)
My support system ensures that I don't look totally incompetent.
Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all.
Humble author of the CLAD Nugget.
0 Kudos
Message 3 of 7
(3,189 Views)

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.

Bill
CLD
(Mid-Level minion.)
My support system ensures that I don't look totally incompetent.
Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all.
Humble author of the CLAD Nugget.
0 Kudos
Message 4 of 7
(3,185 Views)

@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.

0 Kudos
Message 5 of 7
(3,179 Views)

oops, i think i was wrong

Bill
CLD
(Mid-Level minion.)
My support system ensures that I don't look totally incompetent.
Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all.
Humble author of the CLAD Nugget.
0 Kudos
Message 6 of 7
(3,173 Views)

I mean, wrong about the checksum issue.

Bill
CLD
(Mid-Level minion.)
My support system ensures that I don't look totally incompetent.
Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all.
Humble author of the CLAD Nugget.
0 Kudos
Message 7 of 7
(3,170 Views)