To display computers connected to the same WiFi network in C#
Loading
To display computers connected to the same WiFi network in C#
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Sam HobbsPosted Feb 2, 2026, 4:35 PM
Here is sample code that uses
SendPingAsync:For the
subnetparameter, you need to pass the first three octets of your local IP address range (without the last number). The following can get that:Since you specify WiFi explicitly I am not sure if you only want devices connected using WiFi. Many people say WiFi when they mean to say network. Networks can include devices using ethernet instead of WiFi. If you only want devices connected using WiFi then you will need to add code to filter for that.
For Windows, you can alternatively use the IP Helper API through P/Invoke but that is probably more than what you want to do.
Vishal JoshiPosted Feb 2, 2026, 5:16 AM
Try the below method
On Windows, the most common practical is:
Ping sweep the local subnet ? read the ARP table ? resolve hostnames
How it works (high level)
Get your local IP + subnet
Ping every IP in that subnet (fast, parallel)
Read the ARP table (arp -a)
Match IP ? MAC addresses
(Optional) Resolve hostnames
C# console program sample code:
Nabaraj GhimirePosted Feb 1, 2026, 4:35 PM
I don't think it is possible via .NET/C#. What you can do is to ping IPs in the network.
If it responds, device is reachable.