LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

UDP Buffer usage check

Found this reference, which explains how to set the size of the UDP receive buffer and check the value its set to, but this does not help me. 

 

http://digital.ni.com/public.nsf/allkb/D5AC7E8AE545322D8625730100604F2D

 

I know the default receive buffer in Windows XP is set to 8192 and I do not need to modify this.

 

Does anyone know how to read how much of the buffer is being used (n of 8192) at any given moment?

 

Thanks.

-P 

 

Message Edited by Stranman on 03-25-2010 10:37 AM
0 Kudos
Message 1 of 6
(4,329 Views)

Why would you need to know this?

 

 

0 Kudos
Message 2 of 6
(4,315 Views)

The reason is because I'm interfacing w/ a quad serial multiplexer that converts RS-232 to UDP.  The problem is that the multiplexer lacks settings to specify data msg lengths.  The data msg I want is 67 bytes, but the hardware packages UDP packets in parts most of the time 60, then 7 bytes.  Over time if running the loop at the sensor output rate (100Hz), a delay builds in the display of the sensor (because the UDP buffer grows gradually).

  

Asides:

- I've run the loop @ 200Hz, Q'ing data every other sample, which solves the problem, but this is not what I want as the timing is unreliable on a non-RT OS, and I get variable dt intervals w/ intermittent missing data portions.

- I've reduced the delay to <1s after running for 4 hrs by reading UDP twice every 5s.  It would just be nice to see how big the buffer is so I can program how to handle the buffer to ensure "latest" display and logging.

 

 

0 Kudos
Message 3 of 6
(4,310 Views)

I suspected you had a special case.

 

Microsoft has a support doc that you may want to read:

 

INFO: Avoid Data Peeking in Winsock

 

Also read:

 

Winsock: The Lame List

 

I think your case would be #12:

 

Polling with recv(MSG_PEEK) to determine when a complete message has arrived. Thrashing in a sea of lameness.

 

 

Message Edited by Phillip Brooks on 03-25-2010 03:02 PM
0 Kudos
Message 4 of 6
(4,300 Views)

Maybe you should consider a different type of RS-232 multiplexing device.

 

I would recommend watching this thread (started today) and/or the cross-post on the LAVA forums.

0 Kudos
Message 5 of 6
(4,290 Views)

Phillip,

 

The test the code was written for started on Monday, so I've stopped my code development and am using my most acceptable results implementation of oversampling every 5s to help keep the latency down.

 

I was just trying to see if there was a quick "improvement" to the code I could make this go-round or next.  I'm definitely going to look into another vendor to compare when there's time.

0 Kudos
Message 6 of 6
(4,285 Views)