PDA

View Full Version : Determining if Internet Access is Available


Adam
11-22-2007, 03:27 PM
Question:
Can I determine if the user has an Internet connection using AutoPlay Media Studio?

Answer:
If your application utilizes the Internet in any way, you can check to ensure that the user has internet access before continuing, and if they do not, prompt the user to connect.

To accomplish this in AutoPlay Media Studio, enter the following script into an event in your application:

connected = HTTP.TestConnection("http://www.indigorose.com", 20, 80, nil, nil);

if connected then
--Insert your internet related action here
else
Dialog.Message("Internet Error", "You are not connected to the internet. Application will now exit");
Application.Exit();
end

This script checks if the user is connected to the Internet. If after 20 seconds the program cannot find a valid internet connection, it notifies the user, and exits.