Results 1 to 2 of 2
Hello all, I need to receive a number of raw ethernet packets (say, 100 packets) into a user-mode accessible buffer large enough to hold all the packets. The way I ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
- 08-27-2010 #1
- Join Date
- Aug 2010
Send/Receive multiple raw packets in one system call.
I need to receive a number of raw ethernet packets (say, 100 packets) into a user-mode accessible buffer large enough to hold all the packets. The way I have done this so far is by looping over the recvfrom() system call 100 times, passing an incremented pointer addressing the location in my buffer to store the packet.
Is there a way to receive the 100 packets into my buffer with one system call, perhaps by instructing the kernel to DMA the 100 packets into my buffer?
Thanks in advance!
- 08-27-2010 #2
- Join Date
- Apr 2009
- I can be found either 40 miles west of Chicago, in Chicago, or in a galaxy far, far away.
Write your own kernel module?
In truth, it depends upon the availability of the messages. Your drive should buffer them as received, so if you tell recvfrom() to receive an amount of data equal to 100 buffers, if that many are in the hopper (so to speak), then you will/should get them all at once. Bear in mind that recvfrom() is intended for UDP sockets, though it can be used with TCP (connection-oriented) sockets as well. With UDP messages, they may not be provided as a unit. This I am not 100% certain about.Sometimes, real fast is almost as good as real time.
Just remember, Semper Gumbi - always be flexible!