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

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
Who is Participating?
grg99Connect With a Mentor Commented:
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.

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
teltelAuthor Commented:
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.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.