|
|||
|
I have a script that regularly (3 secs) does a load() on a LoadVars() object which works fine (gets a reply) while the network is up, BUT if the network connection is lost (ie. cable unplugged) Flash takes a long time (30 secs+ before it even starts sending requests again) even though the network connection is back up within this time (ie. web browser can fetch webpages).
I have watched the network traffic using Ethereal. Does anyone know of a way that I can get Flash to start sending requests as soon as the network connection returns (ie. not 30 secs+ later)? |
|
|||
|
I guess the load method has a timeout interval about 30+ seconds. When you get online in 30 secs, the load method doesn't return until the timeout interval elapses and the next call is omitted.
You can call the "Inet.IsInetConnected" method to see if you're online every 30 secs. If you're offline, stop the processing. otherwise, start the processing again. I'm not sure if it can work. If you have a solution, please tell us, thanks. |
|
|||
|
From the help manual for 'IsInetConnected' says:
Code:
This method determines the Internet connection state by pinging the site www.swfkit.com. This is not reliable. 1. This is can not be used to determine a network connection, only an open internet connection. What if this URL or UDP traffic is blocked? An incorrect status will be returned. 2. Or even what if your server/net connection/DNS went done? The apps assumption would be that the internet is not available. I remember atleast once that I was unable to surf to the SWFKit website. Can't this be changed to detect if Windows thinks it has a network (not "internet") connection? |
|
|||
|
IE 4+ provides a function can get the status of the network
Code:
Dll.registerFunction(
"wininet.dll", //library name
"InternetGetConnectedState", // function name
"getConnectedState", //alias in SWFKit
"stdcall",//call type
"long",//return type
"ulong*", //param 1
"ulong", //param 2
);
var inetState = new Object;
inetState.value = 0;
if (getConnectedState(inetState, 0))
{
trace(inetState.value);
//inetState.value can be a combination of the following values
//INTERNET_CONNECTION_CONFIGURED = 0x40
//Local system has a valid connection to the Internet,
//but it might or might not be currently connected.
//INTERNET_CONNECTION_LAN = 0x02
//Local system uses a local area network to connect to the Internet.
//INTERNET_CONNECTION_MODEM = 0x01
//Local system uses a modem to connect to the Internet.
//INTERNET_CONNECTION_MODEM_BUSY = 0x08
//No longer used.
//INTERNET_CONNECTION_OFFLINE = 0x20
//Local system is in offline mode.
//INTERNET_CONNECTION_PROXY = 0x04
//Local system uses a proxy server to connect to the Internet.
//INTERNET_RAS_INSTALLED = 0x10
//Local system has RAS installed.
}
|
![]() |
Was this information helpful? Yes No
| Thread Tools | |
| Display Modes | |
|
|