Find the answer to your Linux question:
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.
  1. #1
    Just Joined!
    Join Date
    Aug 2010
    Posts
    1

    Send/Receive multiple raw packets in one system call.


    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 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!

    Corey

  2. #2
    Linux Guru Rubberman's Avatar
    Join Date
    Apr 2009
    Location
    I can be found either 40 miles west of Chicago, in Chicago, or in a galaxy far, far away.
    Posts
    11,539
    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!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •