Academic Company Events NI Developer Zone Support Solutions Products & Services Contact NI MyNI
2 ratings:
 4.5 out of 5     Rate this Document

Lost UDP Packets at Fast Transfer Rates

Primary Software: LabVIEW Development Systems>>Base Package
Primary Software Version: N/A
Primary Software Fixed Version: N/A
Secondary Software: LabVIEW Development Systems>>Full Development System
Hardware: Instrument Connectivity Other>>Ethernet

Problem: When the UDP packets come in at high data rates (greater then 2Mb/s), they start getting lost, especially when the CPU gets loaded by other tasks.

Solution: When the data rate of incoming UDP packets gets high enough, LabVIEW can't keep up with the UDP socket buffer.  This problem only occurs when LabVIEW is moving the buffer into a queue or writing it to file.  Therefore the solution is to increase the OS socket buffer size. This allows more time for LabVIEW to manipulate the buffer contents and perform the next buffer read before the incoming data overflows the socket buffer. 

The only way to set the OS socket buffer size is to make a call to setsockopt function in the wsock32.dll.  Attached are VIs to automatically set and read back the buffer size on the defined socket connection, as well as an example VI using the buffer set/read VIs.  A similar method can be used for TCP to increase the transfer rate.

Related Links:

Attachments:
UDP_buffer_Example.viUDP_buffer_Example.vi
UDP_set_receive_buffer.viUDP_set_receive_buffer.vi
UDP_read_receive_buffer.viUDP_read_receive_buffer.vi





Report Date: 06/22/2007
Last Updated: 07/18/2007
Document ID: 4AL9NF2L

Your Feedback! poor Poor  |  Excellent excellent   Yes No
 Document Quality? 
 Answered Your Question? 
  1 2 3 4 5
Please Contact NI for all product and support inquiries.submit