Join Now
Quality Rating:
  • Currently 0.0 / 5
(0.0 / 5 - 0 votes cast)
This page was last modified 23:12, 7 July 2008.

How to check network status in flashlite 1.1

From Forum Nokia Wiki

In Flash Lite applications connecting to Internet, it is useful to check the network status, while making the connection.

  • If connection is being established or not
  • If connection failed Network error
  • If there is DNS Failure
  • If no HTTP request has been made

In Flash Lite 1.1 GetNetworkRequestStatus command returns a value indicating the current status of the most recent HTTP request. It can be any of the following values.

  • -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.
  • 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

You want to show loading with animation and some time count.

  • Add this ActionScript code in the first frame
/:timerCount = "30";
/:requeststatus = fscommand2("GetNetworkRequestStatus");
  • Type loading text with animated movie clip
  • Load variable HTTP path.
loadVariables("http://www.google.co.in", "", "GET");
  • Check the request of HTTP status
if (/:timerCount>=0) {
	play();
}

As GetNetworkRequestStatus returns 12 status values, you have to use switch statement to update a text with the current status in final_status.

switch (/:requeststatus) {
	case -1 :
		/:final_status = "Request status not supported" add "\n";
		break;
	case 0 :
		/:final_status = "Connection to server has been made" add "\n";
		break;
	case 1 :
		/:final_status = "Connection is being established" add "\n";
		break;
	case 2 :
		/:final_status = "Pending request, contacting network" add "\n";
		break;
	case 3 :
		/:final_status = "Pending request, resolving domain" "\n";
		break;
	case 4 :
		/:final_status = "Failed, network error" add "\n";
		break;
	case 5 :
		/:final_status = "Failed, couldn't reach server" add "\n";
		break;
	case 6 :
		/:final_status = "HTTP error" add "\n";
		break;
	case 7 :
		/:final_status = "DNS failure" add "\n";
		break;
	case 8 :
		/:final_status = "Request has been fulfilled" add "\n";
		break;
	case 9 :
		/:final_status = "Request timed out" add "\n";
		break;
	case 10 :
		/:final_status = "No HTTP request has been made" add "\n";
		break;
		gotoAndStop("error");
}

--Narender Raul

Related Discussions
Thread Thread Starter Forum Replies Last Post
GPRS Status through J2ME mtuhukumar k Mobile Java General 1 2008-02-14 21:29
Connecting to Internet via Emulator earamsey General Symbian C++ 3 2005-04-21 14:06
Network Band Info nishantghai General Symbian C++ 6 2008-06-30 07:03
How to detect and switch network? mplayer.mmboy Symbian Networking & Messaging 2 2008-03-17 11:25
How to Use Read Using TrequestStatus sym_coder General Symbian C++ 2 2005-09-09 09:20
 
Powered by MediaWiki
RDF Facets: qfnZtopicQUqfnTopicZflashE5fliteQ qfnZtypeQUqfnTypeZCommunityContentQ qfnZtypeQUqfnTypeZWebpageQ qfnZtypeQUqfnTypeZWikiContentQ qmarsZlanguageQUxhttpE3aE2fE2fswE2enokiaE2ecomE2flanguageE2d1E2fenX