|
@@ -88,9 +88,13 @@ class Socket {
|
|
onConnect();
|
|
onConnect();
|
|
});
|
|
});
|
|
s.addEventListener(flash.events.IOErrorEvent.IO_ERROR, function(e:flash.events.IOErrorEvent) {
|
|
s.addEventListener(flash.events.IOErrorEvent.IO_ERROR, function(e:flash.events.IOErrorEvent) {
|
|
- out = new SocketOutput();
|
|
|
|
|
|
+ close();
|
|
onError(e.text);
|
|
onError(e.text);
|
|
});
|
|
});
|
|
|
|
+ s.addEventListener(flash.events.Event.CLOSE, function(_) {
|
|
|
|
+ close();
|
|
|
|
+ onError("Closed");
|
|
|
|
+ });
|
|
s.connect(host, port);
|
|
s.connect(host, port);
|
|
#else
|
|
#else
|
|
throw "Not implemented";
|
|
throw "Not implemented";
|
|
@@ -100,7 +104,8 @@ class Socket {
|
|
public function close() {
|
|
public function close() {
|
|
#if flash
|
|
#if flash
|
|
if( s != null ) {
|
|
if( s != null ) {
|
|
- try s.close() catch( e : Dynamic ) {};
|
|
|
|
|
|
+ try s.close() catch( e : Dynamic ) { };
|
|
|
|
+ out = new SocketOutput();
|
|
s = null;
|
|
s = null;
|
|
}
|
|
}
|
|
#else
|
|
#else
|