Determine if send/receive queue is full (Data-link layer).

Posted on 2005-04-14
Last Modified: 2010-04-01
Hi experts,

I'm writing a Win32 program to send ARP requests and receive replys in two threads.
The question is that i need to send so many ARPs (to all subnet IPs) so the send/receive queues may be full.
The consequence is that some of the ARPs are push out of the queue.
Currently my temp solution is to sleep 5 ms each time an ARP is sent so the send queue won't get full.

My question is to find a way to detect the status (if its full) of both send/receive queues?

Many thanks,

Polo Wang
Question by:teltel
    LVL 22

    Accepted Solution

    You'd be better off sending just one or a few  broadcast ARP to all nodes.

    The basic problems are:

    (1)  You can't rely on ARP packets to go out.  ARP like UDP is not guaranteed to be reliable, so the system is free to drop packets anywhere along the line.  There generally is NO way for you to find out what's been dropped or where or why.

    (2)  You can't rely on ARP replies to make it back to you.  They can get dropped due to xmission errors or network colissions.    Even if you slow down your sending rate, the packets going in or out may collide with other net traffic which is beyond your control.

    You could also pace your sending by keeping a maximum limit on the number of outstanding ARp packets out there.  Count the number you send out, count the number you get back, and try to keep the difference to a small number.  The count will climb up, as some nodes are not there, and some replies will get lost.  If you hit your limit, wait a second, that should ensure all outstanding packets are accounted for or lost, then you can restart sending.

    LVL 39

    Expert Comment

    I would recommend to change to TCP/IP. Though it is slower it guarantees all packets to be sent/received in the correct order. If you couldn't change, at the receiver site you would need to request missing or incomplete packets using a second connection. However, that exactly is what TCP/IP does automatically and I could think that it is faster when doing it yourself.

    Regards, Alex
    LVL 1

    Author Comment

    I need to send many ARPs so TCP/IP will take lots of time; I need to setup a tunnel before i can send a ARP through TCP.
    It is still best for me to do it on layer2.

    Featured Post

    6 Surprising Benefits of Threat Intelligence

    All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

    Join & Write a Comment

    In days of old, returning something by value from a function in C++ was necessarily avoided because it would, invariably, involve one or even two copies of the object being created and potentially costly calls to a copy-constructor and destructor. A…
    IntroductionThis article is the second in a three part article series on the Visual Studio 2008 Debugger.  It provides tips in setting and using breakpoints. If not familiar with this debugger, you can find a basic introduction in the EE article loc…
    The viewer will learn how to pass data into a function in C++. This is one step further in using functions. Instead of only printing text onto the console, the function will be able to perform calculations with argumentents given by the user.
    The viewer will learn how to use the return statement in functions in C++. The video will also teach the user how to pass data to a function and have the function return data back for further processing.

    728 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    16 Experts available now in Live!

    Get 1:1 Help Now