air.netURLMonitor The URLMonitor class monitors availablity of an HTTP- or HTTPS-based service.air.net:ServiceMonitor The URLMonitor class monitors availablity of an HTTP- or HTTPS-based service.

This class is included in the aircore.swc file. Adobe® Flash Builder loads this class automatically when you create a project for Adobe® AIR. The Adobe® Flex SDK also includes this aircore.swc file, which you should include when compiling the application if you are using the Flex SDK.

In Adobe® Flash® CS3 Professional, this class is included in the ServiceMonitorShim.swc file. To use classes in the air.net package , you must first drag the ServiceMonitorShim component from the Components panel to the Library and then add the following import statement to your ActionScript 3.0 code:

import air.net.~~;

To use air.net package in Adobe® Flash® Professional (CS4 or higher):

  1. Select the File > Publish Settings command.
  2. In the Flash panel, click the Settings button for ActionScript 3.0. Select Library Path.
  3. Click the Browse to SWC File button. Browse to Adobe Flash CSn/AIKn.n/frameworks/libs/air/aircore.swc file in the Adobe Flash Professional installation folder.
  4. Click the OK button.
  5. Add the following import statement to your ActionScript 3.0 code: import air.net.~~;
URLMonitor Creates a URLMonitor Object for a specified HTTP- or HTTPS-based service.urlRequestflash.net:URLRequestThe URLRequest object representing a probe request for polling the server. acceptableStatusCodesArraynullAn array of numeric status codes listing the codes that represent a successful result.

If you do not specify a value for the acceptableStatusCodes property, the following status codes will be recognized as successful responses:

  • 200 (OK)
  • 202 (Accepted)
  • 204 (No content
  • 205 (Reset content)
  • 206 (Partial content, in response to request with a Range header)
Creates a URLMonitor Object for a specified HTTP- or HTTPS-based service.

After creating a URLMonitor, the caller should call the start() method to begin monitoring the status of the service.

As with the Timer object, the caller should maintain a reference to the URLMonitor object. Otherwise the runtime could delete the object, thereby ending the monitoring.

A URLRequest parameter specifies the probe request for polling the server. Typically, the request method will be either "GET" or "HEAD".

checkStatus Attempts to load content from a URL in the background, to check for a returned HTTP status code. Attempts to load content from a URL in the background, to check for a returned HTTP status code.

If it receives a status code that is listed in the acceptableStatusCodes property, the available property will be set to true. If it receives a status code that is not in the acceptableStatusCodes list, or if there is a security error or I/O error, the available property will be set to false.

toString Returns the string representation of the specified object.A string representation of the object. String Returns the string representation of the specified object.

Note: Methods of the Object class are dynamically created on Object's prototype. To redefine this method in a subclass of Object, do not use the override keyword. For example, a subclass of Object implements function toString():String instead of using an override of the base class.

acceptableStatusCodes The numeric status codes representing a successful result.Array The numeric status codes representing a successful result. urlRequest The URLRequest object representing the probe request.flash.net:URLRequest The URLRequest object representing the probe request.
ServiceMonitor The ServiceMonitor class implements the framework for monitoring the status and availability of network services.flash.events:EventDispatcher The ServiceMonitor class implements the framework for monitoring the status and availability of network services. The ServiceMonitor class acts as the base class for all other service monitors.

This class is included in the aircore.swc file. Adobe® Flash™ Builder™ loads this class automatically when you create a project for Adobe® AIR™. Adobe® Flex™ SDK also includes this aircore.swc file, which you should include when compiling the application if you are using Flex SDK.

In Adobe® Flash® CS3 Professional, this class is included in the ServiceMonitorShim.swc file. To use classes in the air.net package , you must first drag the ServiceMonitorShim component from the Components panel to the Library and then add the following import statement to your ActionScript 3.0 code:

import air.net.~~;

To use air.net package in Adobe® Flash® Professional (CS4 or higher):

  1. Select the File > Publish Settings command.
  2. In the Flash panel, click the Settings button for ActionScript 3.0. Select Library Path.
  3. Click the Browse to SWC File button. Browse to Adobe Flash CSn/AIKn.n/frameworks/libs/air/aircore.swc file in the Adobe Flash Professional installation folder.
  4. Click the OK button.
  5. Add the following import statement to your ActionScript 3.0 code: import air.net.~~;
status Indicates that the service status has changed.flash.events.StatusEvent.STATUSflash.events.StatusEvent Indicates that the service status has changed.

The value of the code property is either "Service.available" or "Service.unavailable", but best practice is to check the value of the ServiceMonitor.available property.

ServiceMonitor Creates a ServiceMonitor object. Creates a ServiceMonitor object.

This class is typically subclassed to monitor specific service types.

After creating a ServiceMonitor object (or a subclass object), call the start() method to begin monitoring the status of the service.

As with the Timer object, the caller should maintain a reference to the ServiceMonitor object. Otherwise, the runtime deletes the object and monitoring ends.

checkStatus Checks the status of the service. Checks the status of the service.

A subclass override method for checking the status of the service.

Typically, this method will initiate a network operation whose completion or failure will result in setting the available property.

JavaScript code can specialize this method by defining a checkStatus() method in the "specializer" object.

makeJavascriptSubclass Adds public ServiceMonitor methods to a JavaScript constructor function's prototype.constructorFunctionObjectThe JavaScript object's prototype property. For example, if the JavaScript object that you are using to serve as a specializer object is named MyHTTPMonitor, pass MyHTTPMonitor.prototype as the value for this parameter. Adds public ServiceMonitor methods to a JavaScript constructor function's prototype.

Adds functions to the JavaScript constructor function's prototype that forward public ServiceMonitor functions to the ServiceMonitor object. This approximates a normal JavaScript subclass of the ActionScript base class.

A JavaScript class specializing a ServiceMonitor would look like this:

// JavaScript Constructor function function MyHTTPMonitor(url, method) { // "that" variable makes "this" available in closures below var that = this; // Required initialization of the service monitor, returns the actual ServiceMonitor object. this.monitor = this.initServiceMonitor(); // Initializes URLStream and event handlers. this._urlStream = new air.URLStream(); this._urlRequest = new air.URLRequest(url); if (method) { this._urlRequest.method = method; } else { this._urlRequest.method = "GET"; } function onStatus(event) { that.monitor.available = Number(event.status) == 200; that._urlStream.close(); } function onError(event) { that.monitor.available = false; that._urlStream.close(); } this._urlStream.addEventListener(air.HTTPStatusEvent.HTTP_RESPONSE_STATUS, onStatus); this._urlStream.addEventListener(air.SecurityErrorEvent.SECURITY_ERROR, onError); this._urlStream.addEventListener(air.IOErrorEvent.IO_ERROR, onError); } // Augment JavaScript prototype with public methods from ServiceMonitor air.ServiceMonitor.makeJavascriptSubclass(MyHTTPMonitor); // Implement specializer functions, just as you would when subclassing a JavaScript class MyHTTPMonitor.prototype.checkStatus = function() { air.trace('OVERRIDDEN checkStatus!', this); this._urlStream.load(this._urlRequest); }

To use the JavaScript class:

var httpMon = new MyHTTPMonitor('http://www.adobe.com')

Be sure to load the AIRAliases.js and aircore.swf files with script tags.

start Starts the service monitor. Starts the service monitor. stop Stops monitoring the service. Stops monitoring the service. toString Returns the string representation of the specified object.A string representation of the object. String Returns the string representation of the specified object.

Note: Methods of the Object class are dynamically created on Object's prototype. To redefine this method in a subclass of Object, do not use the override keyword. For example, a subclass of Object implements function toString():String instead of using an override of the base class.

available Whether the service is currently considered "available." The initial value is false until either a status check sets the property to true or the property is initialized to true explicitly. Typically, this property is set by the checkStatus() implementation in a subclass or specializer, but if the application has independent information about a service's availability (for example, a request just succeeded or failed), the property can be set explicitly. Boolean Whether the service is currently considered "available."

The initial value is false until either a status check sets the property to true or the property is initialized to true explicitly.

Typically, this property is set by the checkStatus() implementation in a subclass or specializer, but if the application has independent information about a service's availability (for example, a request just succeeded or failed), the property can be set explicitly.

lastStatusUpdate The time of the last status update.Date The time of the last status update. pollInterval The interval, in milliseconds, for polling the server.Number0 The interval, in milliseconds, for polling the server.

If zero, the server is not polled periodically, but only immediately after start() is called and when the network status changes.

The ServiceMonitor object only dispatches a status event if service status has changed (not on every poll interval). The object also dispatches a status event as a result of network connectivity changes (regardles of the poll interval).

running Whether the monitor has been started.Boolean Whether the monitor has been started.
SecureSocketMonitor A SecureSocketMonitor object monitors availablity of a TCP endpoint over Secure Sockets Layer (SSL) and Transport Layer Security (TLS) protocols.air.net:SocketMonitor A SecureSocketMonitor object monitors availablity of a TCP endpoint over Secure Sockets Layer (SSL) and Transport Layer Security (TLS) protocols.

This class is included in the aircore.swc file. Flash Builder loads this class automatically when you create a project for AIR. The Flex SDK also includes this aircore.swc file, which you should include when compiling the application if you are using Flex SDK.

In Adobe® Flash® CS3 Professional, this class is included in the ServiceMonitorShim.swc file. To use classes in the air.net package , you must first drag the ServiceMonitorShim component from the Components panel to the Library and then add the following import statement to your ActionScript 3.0 code:

import air.net.~~;

To use air.net package in Adobe® Flash® Professional (CS4 or higher):

  1. Select the File > Publish Settings command.
  2. In the Flash panel, click the Settings button for ActionScript 3.0. Select Library Path.
  3. Click the Browse to SWC File button. Browse to Adobe Flash CSn/AIKn.n/frameworks/libs/air/aircore.swc file in the Adobe Flash Professional installation folder.
  4. Click the OK button.
  5. Add the following import statement to your ActionScript 3.0 code: import air.net.~~;
SecureSocketMonitor Creates a SecureSocketMonitor object for a specified TCP endpoint.hostStringThe host to monitor. portintThe port to monitor. Creates a SecureSocketMonitor object for a specified TCP endpoint.

After creating a SecureSocketMonitor object, the caller should call start to begin monitoring the status of the service.

As with the Timer object, the caller should maintain a reference to the SecureSocketMonitor object. Otherwise, the runtime deletes the object and monitoring ends.

createSocket Creates a SecureSocket object.SecureSocket the SecureSocket object to be used by this SocketMonitor or null if secure sockets are not supported on the current system. flash.net:Socket Creates a SecureSocket object. toString Returns the string representation of the specified object.A string representation of the object. String Returns the string representation of the specified object.

Note: Methods of the Object class are dynamically created on Object's prototype. To redefine this method in a subclass of Object, do not use the override keyword. For example, a subclass of Object implements function toString():String instead of using an override of the base class.

SocketMonitor A SocketMonitor object monitors availablity of a TCP endpoint.air.net:ServiceMonitor A SocketMonitor object monitors availablity of a TCP endpoint.

This class is included in the aircore.swc file. Flash Builder loads this class automatically when you create a project for AIR. The Flex SDK also includes this aircore.swc file, which you should include when compiling the application if you are using Flex SDK.

In Adobe® Flash® CS3 Professional, this class is included in the ServiceMonitorShim.swc file. To use classes in the air.net package , you must first drag the ServiceMonitorShim component from the Components panel to the Library and then add the following import statement to your ActionScript 3.0 code:

import air.net.~~;

To use air.net package in Adobe® Flash® Professional (CS4 or higher):

  1. Select the File > Publish Settings command.
  2. In the Flash panel, click the Settings button for ActionScript 3.0. Select Library Path.
  3. Click the Browse to SWC File button. Browse to Adobe Flash CSn/AIKn.n/frameworks/libs/air/aircore.swc file in the Adobe Flash Professional installation folder.
  4. Click the OK button.
  5. Add the following import statement to your ActionScript 3.0 code: import air.net.~~;
SocketMonitor Creates a SocketMonitor object for a specified TCP endpoint.hostStringThe host to monitor. portintThe port to monitor. Creates a SocketMonitor object for a specified TCP endpoint.

After creating a SocketMonitor object, the caller should call start to begin monitoring the status of the service.

As with the Timer object, the caller should maintain a reference to the SocketMonitor object. Otherwise, the runtime deletes the object and monitoring ends.

checkStatus Calling the checkStatus() method of a SocketMonitor object causes the application to try connecting to the socket, to check for a connect event. Calling the checkStatus() method of a SocketMonitor object causes the application to try connecting to the socket, to check for a connect event. createSocket Creates a Socket object.the Socket object to be used by this SocketMonitor. flash.net:Socket Creates a Socket object. toString Returns the string representation of the specified object.A string representation of the object. String Returns the string representation of the specified object.

Note: Methods of the Object class are dynamically created on Object's prototype. To redefine this method in a subclass of Object, do not use the override keyword. For example, a subclass of Object implements function toString():String instead of using an override of the base class.

host The host being monitored.String The host being monitored. port The port being monitored.int The port being monitored.