S
S
Senya42021-10-20 17:56:55
C++ / C#
Senya4, 2021-10-20 17:56:55

How to get the name of the wifi that the computer is connected to?

Good day, I need to find out the name of the wifi network to which the computer is connected.
Tell me how to do it.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
Vasily Bannikov, 2021-10-20
@senya4

AndromedaStar's answer is correct, but it needs to be clarified that this is a class from a third party library.
https://habr.com/en/post/181251/
Here is the library itself: https://github.com/consp1racy/NativeWifi
But I do not recommend using it, because it has not been updated for 8 years.
Instead, I advise you to use: https://www.nuget.org/packages/ManagedNativeWifi/

using ManagedNativeWifi;
var connections = NativeWifi.EnumerateInterfaceConnections();
var firstConnection = connections.First();
Console.WriteLine(firstConnection.ProfileName);

Works, of course, only on Windows. On Linux, only the option with parsing the output of iwlist comes to mind

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question