Categories
.net Networking programming Solutions

Scanning your entire LAN for MAC Addresses

Not too long ago, I wrote a network administration utility with specific needs.
One of the needs was to scan all the LAN pool for MAC addresses.
The code will look at your active network adapters, calculate start and end IP according to your address and netmask,
and query all the IPs within that range for their MAC address.
The code is written in C#, and it’s basically going over the whole range in a nested loop.
If you find this useful, you are welcome to use the code:

Categories
programming

The strange case of the BackgroundWorker and the disappearing exception

I was recently building a simple GUI in .NET to operate an algorithm as part of a school project, and I encountered a weird problem using BackgroundWorkers. I spent a lot of time debugging it, mainly because the code seemed to be perfect (which was true) but the run-time behavior was so strange…
Anyway, to make my algorithm as weakly-coupled as possible decided not to use BackgroundWorker.ReportProgress‘, because then my algorithm will have to know what a BackgroundWorker is…
I decided to actually fire my own event whenever I wanted to report on the algorithm progress (which is rather lenghty). So I defined my delegate and event inside my one-function class that runs the algorithm: