LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How do I flush the UDP buffers from within LabVIEW?

In order to more effectively utilize UDP based communications, I would like to flush any previous UDP messages from the O/S buffer so that I can start or re-start my LabVIEW application without any "leftovers" still in the system from a previous run.  I would like any pointers on ways to do this.  I do not see how to do this with the existing LabVIEW elements.
Thanks.
Steve
0 Kudos
Message 1 of 6
(6,790 Views)

Hi Steve,

      Sorry if this sounds simplistic, however...:

When the LabVIEW application starts-up, why not just call "UDP Read" (w/ 0 ms timeout) and ignore the returned data?

Regards
When they give imbeciles handicap-parking, I won't have so far to walk!
Message 2 of 6
(6,787 Views)
 TCP protocol uses 20 bytes header were as UDP only uses 8 bytes!

 UDP primarily function is to send data as quickly as possible. It does not care if it fails to connect!!!!
The act of flushing the buffer negates the principle of UDP!!

In other words it ain't necessary.

chow
 xseadog
Message 3 of 6
(6,773 Views)

Hi xseadog,

      Steve's request sounded reasonable, but I'm not that familier with the details of UDP.  Why (again) would you not treat a UDP input buffer, like a serial (COM port) input buffer - where one might reasonably worry about trash characters accumulating?  Re: TCP, same question.  Another ("remote") LabVIEW application could be sending unsolicited or incomplete messages to me periodically, and the packet-level detail is transparent to my application.  From my point of view, bytes are accumulating in an input buffer, and I might want to flush that buffer before explicitly requesting data from the device.  So I don't understand your point about packet-level header-sizes!?

Clue me in, man!

D.

When they give imbeciles handicap-parking, I won't have so far to walk!
0 Kudos
Message 4 of 6
(6,750 Views)

Good evening,

I think the issue here is that with a UDP connection the idea is to create a fast half-duplex connection between a server and a client.  If the client does not have a socket open, an error is generated and no datagram is buffered.  Therefore there should be no “junk” packets of information in a port buffer to clear.  In addition I believe that the UDP read can never read more than one packet worth of data – further illustrating that there really is no UDP buffer that is set up in your OS to clear.

Thanks for posting -- hopefully this helps.  Please let us know if anyone has any other questions!

 


Regards,

Travis M
Applications Engineer
National Instruments

Travis M
LabVIEW R&D
National Instruments
0 Kudos
Message 5 of 6
(6,735 Views)

Thanks Travis,

      I get the point (I think) - there should be no junk when the [UDP] port is first opened, and this seems to be the specific concern of the original post.  I've never found junk in a serial-port, when first opened, for that matter!

Thanks.

When they give imbeciles handicap-parking, I won't have so far to walk!
0 Kudos
Message 6 of 6
(6,724 Views)