Windows: getCurrentConnections returns null when multiple interfaces exist
See original GitHub issueWhen there are multiple wifi interfaces exist in Windows environment and if the first one is disconnected, the getCurrentConnections()
returns null.
Expected Behavior
The getCurrentConnections()
should return connected connections from any interfaces
Current Behavior
When there are multiple wifi interfaces exist in Windows environment and if the first one is disconnected, the getCurrentConnections()
returns null.
Affected features
- [Y] node API
- cli
Possible Solution
I have confirmed working after modified the windows-current-connections.js
by following:
function parseShowInterfaces(stdout) {
...
for (var j = 0; j < fields.length; j++) {
var line = lines[i + j];
//===== MY CHANGE START
// tmpConnection[fields[j]] = line.match(/.*: (.*)/)[1];
const lineMatch = line.match(/.*: (.*)/);
if (lineMatch == null) {
// bad line, skip current interface and move to next one
i += j + 1;
j = -1;
} else {
tmpConnection[fields[j]] = lineMatch[1];
}
//===== MY CHANGE END
...
}
Steps to Reproduce (for bugs)
- Prepare environment with two wifi interfaces
- Only connect wifi from second wifi interfaces. I.e. second means whatever it appears in second from ‘netsh wlan show interfaces’
- Run wifi-node.getCurrentConnections()
- Check the output.
Context
Your Environment
- OS:
- node-wifi version
- wifi card:
Issue Analytics
- State:
- Created 3 years ago
- Comments:7 (3 by maintainers)
Top Results From Across the Web
Issues · friedrith/node-wifi
[Bug]: Wrong data returns for getCurrentConnections on windows 11 ... Windows: getCurrentConnections returns null when multiple interfaces exist.
Read more >About WinHTTP API behavior with multiple network interfaces
If multiple network interfaces (NICs) exist, the above API is supposed to automatically select the network interface to use.
Read more >Internet connection sharing null Windows 10
Context: I have bad wifi in my room and hence tried to enable internet connection sharing but got a null message, " An...
Read more >Unable to connect to internet using multiple interfaces.
Started troubleshooting after booting up my PC, ping 127.0.0.1 returns with "unable to contact IP driver. General failure" A Tracert for ...
Read more >Dual-STA query and configuration - Win32 apps
There are two types of interfaces associated with adapters that support dual ... dwResult); WlanCloseHandle(hClient, NULL); return dwResult; ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Ok I will try to propose a fix
I am glad you found a workaround. Unfortunately, windows use async commands so you don’t know exactly when the job will be finished.