Permalink
Browse files

add try catch

  • Loading branch information...
1 parent f13d559 commit 54c220093305d4f7809604f34adba9c9b224bba9 @marzwu committed Apr 21, 2012
Showing with 13 additions and 5 deletions.
  1. +11 −4 Client/src/index.as
  2. +2 −1 Client/src/net/SocketClient.as
View
15 Client/src/index.as
@@ -2,14 +2,21 @@ package
{
import flash.display.Sprite;
import flash.net.Socket;
-
+
import net.SocketClient;
-
+
public class index extends Sprite
{
public function index()
{
- new SocketClient('127.0.0.1',3456);
+ try
+ {
+ new SocketClient('127.0.0.1', 3456);
+ }
+ catch (e:Error)
+ {
+ trace(e);
+ }
}
}
-}
+}
View
3 Client/src/net/SocketClient.as
@@ -29,7 +29,7 @@ package net
private function writeln(str:String):void
{
- str += "\n";
+// str += "\n";
try
{
writeUTFBytes(str);
@@ -52,6 +52,7 @@ package net
{
var str:String = readUTFBytes(bytesAvailable);
response += str;
+ trace(response);
}
private function closeHandler(event:Event):void

0 comments on commit 54c2200

Please sign in to comment.