Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issues connecting Wifi on Windows #26

Closed
retiutut opened this issue Mar 19, 2019 · 14 comments · Fixed by #27
Closed

Issues connecting Wifi on Windows #26

retiutut opened this issue Mar 19, 2019 · 14 comments · Fixed by #27

Comments

@retiutut
Copy link
Contributor

retiutut commented Mar 19, 2019

My Wifi shield has an address of 10.0.1.12 and is attached to a Ganglion board.

Able to connect and stream data using auto-detect and wifi direct on a Mac running OS X Mojave with OpenBCI_NodeJS_Wifi tests and in the Hub.

Using a Windows 10 machine, getStreamingWiFiDirect.js produces an error. This same error is happening in the current GUI when trying to connect, along with other errors stemming from a failure to connect.

PS C:\Users\Retiutut\Documents\GitHub\OpenBCI_NodeJS_Wifi\examples\getStreamingWiFiDirect> node getStreamingWifiDirect.js
TCP: on port:  51599
Attempting to connect to 10.0.1.12
-> POST: 10.0.1.12/tcp {"ip":"192.168.56.1","output":"raw","port":51599,"delimiter":false,"latency":16667}
server listening 192.168.56.1:62971
STATUS: 504
No more data in response.
BODY: {"connected":false,"delimiter":false,"ip":"192.168.56.1","output":"raw","port":51599,"latency":16667}
Error: ERROR: CODE: 504 MESSAGE: {"connected":false,"delimiter":false,"ip":"192.168.56.1","output":"raw","port":51599,"latency":16667}
    at IncomingMessage.res.once (C:\Users\Retiutut\Documents\GitHub\OpenBCI_NodeJS_Wifi\openBCIWifi.js:1120:16)
    at Object.onceWrapper (events.js:276:13)
    at IncomingMessage.emit (events.js:193:15)
    at endReadableNT (_stream_readable.js:1129:12)
    at process.internalTickCallback (internal/process/next_tick.js:72:19)
@andrewjaykeller
Copy link

Looks like the wifi shield failed to connect to your computers server. I would check you computers firewall permissions or the permissions on the nodejs file?

Here is the line of code that is producing that error

Cheers

@retiutut
Copy link
Contributor Author

I turned off Windows Firewall and set VSCode to "Run as Admin". Still getting same error.

@andrewjaykeller
Copy link

Could you create a test application that streams data into the nodejs application to test the internal server? It sounds like we need to approach this problem from another angle.

@retiutut
Copy link
Contributor Author

retiutut commented Mar 19, 2019

Here is a successful log when using Mac. I notice that my host machine starts with 10. just like the WiFi shield

TCP: on port:  60127
Attempting to connect to 10.0.1.12
-> POST: 10.0.1.12/tcp {"ip":"10.0.1.19","output":"raw","port":60127,"delimiter":false,"latency":16667}
server listening 10.0.1.19:61087
STATUS: 200
No more data in response.
BODY: {"connected":true,"delimiter":false,"ip":"10.0.1.19","output":"raw","port":60127,"latency":16667}
Connected to 10.0.1.12

The Windows machine IP address starts with 192.

@andrewjaykeller
Copy link

i agree with your edit, what is your windows computer ip address?

@retiutut
Copy link
Contributor Author

The Windows machine is supposedly at 192.168.56.1

@andrewjaykeller
Copy link

seems weird those ip addresses are so different right?

@retiutut
Copy link
Contributor Author

Woah now.... Windows 10 says my IP address should be 10.0.1.14! Bug found!

@andrewjaykeller
Copy link

awesome, im in class, be back later, lmk if u find the solution 🚀

@retiutut
Copy link
Contributor Author

retiutut commented Mar 19, 2019

Looking into a fix using parameters for ip.address(), as seen in indutny/node-ip#79

@retiutut
Copy link
Contributor Author

retiutut commented Mar 20, 2019

@andrewjaykeller Got it working using

 this.wifiServerUDP.bind({
    address: ip.address("Ethernet", "ipv4")
  });

I think a more generalized fix would select Ethernet, or a WiFi network interface if Ethernet is not available. What are your thoughts?

@andrewjaykeller
Copy link

This could be a huge fix for windows users who have had WiFi connection issues on windows!

@retiutut
Copy link
Contributor Author

Just tried the above code on a Mac, and the network interfaces follow a different standard (ex en0, en1). The fix for this issue should be contained to Windows OS case.

@retiutut retiutut mentioned this issue Mar 22, 2019
@retiutut
Copy link
Contributor Author

To fix this issue, the following now happens on WindowsOS only:

  • First, look for "Ethernet" network interface
  • If "Ethernet" is not available, look for "Wi-Fi" network interface
  • Otherwise, use first available network interface

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants