The example MPH file used in this section is available in the Application Gallery at
www.comsol.com/model/time-limited-and-hardware-locked-application-70151.
In order to check the MAC address when running an application, you need to enable Allow access to network sockets under
Security in
Preferences. However, for a compiled application, no security changes are needed.
This method has one array 1D string input argument, allowedAddresses, and one Boolean output argument,
ok, as shown below.

You can call this type of method at startup of the application, for example, as an On load event for the main form of the application. In the Tuning Fork example application, available in the Application Library of COMSOL Multiphysics, there is a method
p_init_application that is run as an
On load event for the main form. In this case, the method
p_init_application can be edited as follows:
Notice the call to the method check_allowed_to_run in the first line. The figure below shows this method in the Method Editor.

The method p_init_application is then called as an
On load event. This is specified in the
Settings window of the main form, as shown in the figure below.
