From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Increase UDP received packets per second

Solved!
Go to solution

Attached is a visual studio 2015 project which has the new functions, and a labview library which has the wrappers for the new functions.

 

The most important one is "Read N Packets.vi".  I did not include an examplef or using it, but you can use it in place of "Read Packet.vi" which does have an example.  The differences are that you:

1) Must specify the number of packets you want returned

2) Must specify the length of the packets, any packet not matching that length will be dropped.  The length of the packets will be specified by header length and data length seperatly.  The block will output a seperate string array for headers and data.  This also means you need to pass it two initlzied string arrays instead of one (again, you can see an example of this when you look at the 'Read Packet.vi' example)

 

The dll is not in the labview folder, its located in the 'Release' folder of the visual studio project.  Labview will probably ask where that dll is when you first open the library.  I didn't combine them becuase I wanted to make it easier for people to make changes to the dll.

Download All
Message 11 of 37
(5,508 Views)

Thank you!

 

I have given you as many Kudos as I can and also tagged you post to make it possible for those that will someday follow in your foot steps to find you code.

 

Thank you!

 

Ben

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
0 Kudos
Message 12 of 37
(5,500 Views)

Great, thanks.

 

A note about the code, the current version of Read N Packets is a BLOCKING CALL, if you don't receive the N packets then you wont ever return...  I'll try and make a new version that does allow timeouts.

 

The code has been tested to 800Mbps, 200Mpps, on a 16GB 8 core i7.  If you do no additional processing then I've seen it work on far lower performing machine (4GB, i5).

 

Message 13 of 37
(5,461 Views)

Sorry guys but jjjcjj found one of my soft spots so he is getting Kudos today.

 

jjjcjj,

 

Again thank you. I appreciate your willingness to share and help others. While I am not currently working on a Ethernet based applciation I did recently deliver an applition where I used and Absolute Analysis Investigator

 

Investigator.png

 

To do verification checks on a multi-port ethernet widget. The Investigator was used becuase I neede to inject bad frames and do latency measurements.

 

And way way back when I was a wee-youth and before I learned how to spell "G" I worked with a buddy to write what may have been one of the first sniffer programs back in 1988. It was written in VAX-Macro, used promiscuous mode to capture frames a a kernal mode driver was used to transfer the data to be logged to disk. Hell, computers were so slow bach then we did not even entertain the diea of formatting packets on the fly. I wrote a second program latter that did parse oout the source Destination and protocol and wrote it to a file.

 

There is just something about your first love that sticks with you.

 

Again thansk for sharing!

 

Ben

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
Message 14 of 37
(5,448 Views)

I get that, I enjoy it as well.

 

I typoed earlier, it's 200Kpps not 200Mpps.

 

Also, attached is a newer version that DOES include a timeout on Read N Packets.  it doesn't have as much testing, but I think its fine.

Download All
Message 15 of 37
(5,431 Views)

Nice entry into the forums!

 

You are starting out with 9 kudos after 8 posts.

 

Only Jeff Kodosky (fathr of LabVIEW) has ever pulled off a ratio that high.

 

Feel free to visit any time you want!

 

Ben

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
0 Kudos
Message 16 of 37
(5,426 Views)

(Ah that brings back memories. about 15+ years ago I wrote a parser for most raw ethernet packets...)

 

I haven't looked at the code in detail, but with the next overhaul you might want to place the connected terminals on the toplevel diagram, i.e. outside the case structure. (for details, see this disucssion and the link in it).

 

The project also refers to a "UDP buffer example small.vi" that seems to be missing

Message 17 of 37
(5,424 Views)

Will do.

 

I also want to point out in case its not clear that this is a modification to someone else work which can be found here: http://forums.ni.com/t5/LabVIEW/WinPCAP-for-LabView-v-0-1-alpha/td-p/343479/page/2

 

I have simply added functions to perform block transfers and included the visual studio project to help others recompile.

 

I have asked a moderator to make that clear in my first post which contains project files.

0 Kudos
Message 18 of 37
(5,419 Views)

Hey, I found my old parser code, here are some diagrams... 😉 (they could contain bugs, of course. not edited since 2001).

 

(Maybe I could reuse some of them in your code. The main program is no longer useful because I no longer have the hardware that sends these packets)

 

Note that arranging the type clusters with correctly size labels (based on U8, U16, U32) helps when comparing with the RFC's 😄

 

 

Message 19 of 37
(5,407 Views)

Neat, that would be a nice edition.  The original author (paging @jh_mclellan) has some amount of that in the demo design, but certainly not that detailed.

 

 

I've already gotten some common questions, so I figured I'd post those now:

1)  If you dont get the expected peformance then:

- Increase your DefaultReceiveWindow registery entry to something like 0x01000000 (16MB)

- Increase the number of packets you collect per call.  In my testing so far about 1ms per call is good.

- Have Read N Packets put its data into a queue, and use a seperate loop for processing

 

2) You need to install the visual studio 2015 x86 runtime.  You should probably just install Visual Studio 2015 community edition though.

 

3)  You need the winpcap library installed.  If you have ever installed Wireshark on your machine then you probably have this already.  The visual studio project contains the winpcap developer pack already. 

Message 20 of 37
(5,313 Views)