GetNetworkRequestStatus

Availability

Flash Lite 1.1.

Description

Returns a value indicating the status of the most recent HTTP request.

Command

Parameters

Value returned

"GetNetworkRequestStatus"

None.

-1: The command is not supported.

0: There is a pending request, a network connection has been established, the server's host name has been resolved, and a connection to the server has been made.

1: There is a pending request, and a network connection is being established.

2: There is a pending request, but a network connection has not yet been established.

3: There is a pending request, a network connection has been established, and the server's host name is being resolved.

4: The request failed because of a network error.

5: The request failed because of a failure in connecting to the server.

6: The server has returned an HTTP error (for example, 404).

7: The request failed because of a failure in accessing the DNS server or in resolving the server name.

8: The request has been successfully fulfilled.

9: The request failed because of a timeout.

10: The request has not yet been made.

Example

The following example assigns the status of the most recent HTTP request to the requesttatus variable, and then uses a switch statement to update a text field with the status:

requeststatus = fscommand2("GetNetworkRequestStatus");
switch (requeststatus) {
    case -1:
        /:myText += "requeststatus not supported" add newline;
        break;
    case 0:
        /:myText += "connection to server has been made" add newline;
        break;
    case 1:
        /:myText += "connection is being established" add newline;
        break;
    case 2:
        /:myText += "pending request, contacting network" add newline;
        break;
    case 3:
        /:myText += "pending request, resolving domain" add newline;
        break;
    case 4:
        /:myText += "failed, network error" add newline;
        break;
    case 5:
        /:myText += "failed, couldn't reach server" add newline;
        break;
    case 6:
        /:myText += "HTTP error" add newline;
        break;
    case 7:
        /:myText += "DNS failure" add newline;
        break;
    case 8:
        /:myText += "request has been fulfilled" add newline;
        break;
    case 9:
        /:myText += "request timedout" add newline;
        break;
    case 10:
        /:myText += "no HTTP request has been made" add newline;
        break;
}