sta / websocket-sharp

A C# implementation of the WebSocket protocol client and server
http://sta.github.io/websocket-sharp
MIT License
5.74k stars 1.66k forks source link

Local ip check update #729

Open foxmcloud555 opened 1 year ago

foxmcloud555 commented 1 year ago

We need to establish a websocket connection between two devices connected to the same mobile hotspot.

This means we can't reliably get a valid DNS entry for the isLocal check.

I have just added extension that will return true if a supplied IP is within the Private ranges.

kijz commented 1 year ago

tested this today and also saved me a lot of trouble, while trying to connect via iOS on a local network (no internet).

var name = System.Net.Dns.GetHostName ();
var addrs = System.Net.Dns.GetHostAddresses (name);

would never return the ip address in the local network, which you can view via Wifi (i) icon. Worked on android though.

MerijnHendriks commented 11 months ago

Thanks for the commit, it really helped me out! You probably do want to update the pull request to use the same styling as the rest of the codebase.