weimingtom / darkstar-as3

Automatically exported from code.google.com/p/darkstar-as3
1 stars 0 forks source link

IOErrorEvent & SecurityErrorEvent #4

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
The IOErrorEvent is not supported by SimpleClient. Dispatched if a host is
specified and an input/output error occurs that causes the connection to fail.

The SecurityErrorEvent is not supported too. Dispatched if a call to
Socket.connect() attempts to connect to either a server outside the
caller's security sandbox or to a port lower than 1024.

Original issue reported on code.google.com by alexis.c...@gmail.com on 18 Mar 2009 at 8:08

GoogleCodeExporter commented 9 years ago
I agree, the client should support these events.

Original comment by tig...@gmail.com on 24 Mar 2009 at 3:51

GoogleCodeExporter commented 9 years ago
I have added code to handle the IOErrorEvent (just starting out).  Will this be
fixed?  A simple fix was posted in the Darkstar Forums a while ago.

Thanks for doing this, you've made it alot easier for little guys to get up and 
running!

Original comment by mchu...@gmail.com on 11 Apr 2009 at 8:30

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
Hi

I've been looking into a solution for this problem too. I was about to go poking
around and try to fix it myself, but is this already being (or has been) fixed?

Original comment by niceman...@gmail.com on 17 Jun 2009 at 5:08

GoogleCodeExporter commented 9 years ago
To have a quickfix, add these lines to the SimpleClient constructor:

sock.addEventListener(IOErrorEvent.IO_ERROR, dispatchEvent);
sock.addEventListener(SecurityErrorEvent.SECURITY_ERROR, dispatchEvent);

This way, the SimpleClient will rethrow (reDispatch?) the event to the next 
listener.
Make sure you catch this event in your own application like:

client = new SimpleClient("localhost",1139);
client.addEventListener(IOErrorEvent.IO_ERROR, onIOErrorEvent);

and eg

private function onIOErrorEvent(e:IOErrorEvent):void {
     Alert.show("Error communicating with server:\n" + e.text + "\n\nPlease check
your internet connection or the status of the server.","Network error");
}

Have fun,
- Robbie

Original comment by robbie.d...@gmail.com on 7 Jul 2009 at 2:27