Check Methods
Check methods are responsible for determining the current internet connection. They are all using the Captive Portal Detection technique, which is used by all major operating systems. However, there are different check methods available. While they all work in the same way, the data they use to determine whether internet connection can be established can differ. Eazy NetChecker comes with a few ready to use check methods, but is also extendable by allowing you to set custom check methods to fit your requirements.
Standard Check Methods
As already stated, Eazy NetChecker uses check methods that major operating systems are using. In particular, the following methods come ready to be used in Eazy NetChecker
Google 204
Google 204 is one of the captive portal detection methods that Google uses in its own operating systems and devices. You can use Google204 by selecting it in the editor, or by calling the following function
Google204 is just an empty page hosted by google. The method just expects an HTTP 204 status code from it.
Microsoft NCSI
Microsfto NCSI is a text file hosted by Microsoft, and is the method used by Microsoft for internet status detection. Select it from the editor, or use the following function:
Unlike Google204, Microsoft NCSI expects certain content to be returned from the HTTP request, instead of a status code. Specifically it expects to get the following text
Apple Hotspot
Apple hotspot is very similar to Microsoft NCSI, but it is used by Apple. Use it by selecting it in the editor or by using the following function:
Apple Hotspot expects to get a specific HTML code as content:
Custom Check Methods
Eazy NetChecker is fully flexible and extentable since it allows you to create your own custom check methods to specifically fit your needs. You may ask why would you want a custom one since the standard check methods are from major companies and are supposed to be reliable. Well, take for example the case where you want to download something from your own server in your game. Internet connection may be present and working fine, therefore a Google204 will detect a connected network. However, your server may actually be down and therefore your game cannot really connect to it. While general internet connection may be working fine, the connection you actually want to establish is unavailable. Custom check methods are used for cases like that.
Creating Check Method Pages
First, you need to create the check method page exactly as you like it, and upload it to your server. This will act as the check link. You will also need to decide whether you want to check against HTTP status code, or the content of the link.
For example, let's create a custom check method for Hellmade Games (You can name your check method to match your needs). First, create an empty html page and name it connectioncheck.html. In this example, we will use page content as the expected response. Just put a simple text in your page that will act as the expected content:
That's it for the html page. Now just upload it on your server. You can find ours at http://www.hellmadegames.com/connectioncheck.html
Check Method Setup
Now, you just need to set it up in Eazy NetChecker. You can do it both in the editor, or during runtime from code.
Editor
All you need to do is create a new custom check method by writing its ID (name) and click the + button. The new check method will be added to the list. In the link field, just add the link to your uploaded html page. Then select the expected response type from the tabs below (Response content in our example), and just write down what the expected content is (if content is selected), or select the expected HTTP status code (if HTTP status code is selected).
You are all done. If you want to use your new method, just select it.
Runtime
Creating a custom method during runtime is still super easy:
If your check method is using an HTTP status code instead, you can create it in a very similar way (let's say you want an HTTP 204):
You can now either add it to your custom methods and use it:
Or just use it without adding it:
Adding it to your custom methods will make it available to use later on if for some reason you select another check method in between.
Check methods created during runtime are not retained after execution is finished. If you want to setup check methods that are saved, create them in the editor.
Last updated