01-27-2011 08:29 PM
I've been trying to test WIFI connectivity of my app, ie goaltending for when WIFI is not available.... I get different results when 1) my host computer WIFI is not connect to a network and 2) when my host computer is connect to a network, and I just disconnect the NAT adaptor in VMWare....
When my host computer is not connected to a network, the app responds correctly both stand alone and through the simulator....If I make a server call in the app, the response is null and the correct error message shows up.
If I leave my host computer connected to a network, and disable the NAT in the simulator and make a server call in my app it just suspends.....If I disconnect the host computer from a network, then reconnect the NAT then I get the correct error messaging....
It's as if when the NAT is disabled, the server call is never made....What's makes this difficult to debug is that when the NAT is disabled, I can no longer get traces through the debug player....
If my app is responding properly when the host computer is not connected to a network, is that enough to test WIFI connectivity?
How is everyone else testing WIFI connectivity??
01-27-2011 08:50 PM
how are you checking the status of the network connection? below is a sample code i use to check for net connectivity. it seems to work all the time accurately:
public class NetworkTest extends Sprite
private var myBtn:LabelButton;
private var myLabel:Label;
public function NetworkTest()
// support autoOrients
stage.align = StageAlign.TOP_LEFT;
stage.scaleMode = StageScaleMode.NO_SCALE;
myBtn = new LabelButton();
myBtn.label = "Start Test";
myLabel = new Label();
myLabel.text = "Status: Not Started";
myLabel.autoSize = TextFieldAutoSize.LEFT;
private function onClick(e:MouseEvent):void
private function startTest():void
var urlRequest:URLRequest = new URLRequest( "http://google.com" );
urlMonitor = new URLMonitor( urlRequest );
urlMonitor.addEventListener( StatusEvent.STATUS, onStatusEvent );
private function onStatusEvent(e:StatusEvent):void
myLabel.text = "Status: " + e.code;
If you run that code there should be a button that shows up to click and it will tell you the status of the net connection. and when you disconnect, it should update the status with the disconnected status. you can easily change it to work with different Events such as ENTER_FRAME, etc. hope that helps some. good luck!
01-27-2011 09:26 PM
I'm using the following listeners when I make a server call:
IOErrorEVENT and SecuritErrorEvent....
; loader.addEventListener(IOErrorEvent.IO_ERROR,retr y); loader.addEventListener(SecurityErrorEvent.SECURIT Y_ERROR,onError); loader.addEventListener(ProgressEvent.PROGRESS,onP rogress);
They work fine standalone and through the simulator when my host computer WIFI is disconnected from the network....It's when the NAT of the simulator is disconnected that things start acting up...
With your method do I just make a URLrequest ONCE when I launch my app at the begining, and will the onStatusEvent be called whenever the PlayBook connects and disconnects for the duration the app is running? Or do you have to keep polling the server on a regular interval?
How are you testing lack of WIFI? Disabling NAT in the simulator or disconnecting WIFI on the host computer? I'm still not sure why my method wouldn't work....
01-27-2011 11:34 PM
back before when i used this it worked like a charm. as soon as i disconnect or reconnect (laptop wifi connection) it'd pop up with a notfication that it disconnected. now i re-did some tests to confirm things but they arent consistent as they were before. i dont know if the simulator difference has anything to do with it. back when it worked, i was using the older sim. havent done tests on the new one till now.
but idealistically once the monitor starts it dispatches the statusevent when the connection status changes. and i tried doing the disconnect network adapter in vmware. the results varied but basically it'd pick up hte disconnect about a minute after i disconnected the adapter. but it would detect that i reconnected after that.