Chapter 24 Example 3
♥0 |
Line 20 |
Modified 2010-01-28 15:01:01 |
MIT License
archived:2017-03-30 03:23:25
ActionScript3 source code
/**
* Copyright actionscriptbible ( http://wonderfl.net/user/actionscriptbible )
* MIT License ( http://www.opensource.org/licenses/mit-license.php )
* Downloaded from: http://wonderfl.net/c/fQWZ
*/
package {
import com.actionscriptbible.Example;
import flash.errors.IOError;
import flash.net.Socket;
public class ch24ex3 extends Example {
public function ch24ex3() {
try {
var s:Socket = new Socket();
s.connect("http://www.actionscriptbible.com/", 80);
//TODO: add asynchronous error handling;
//see Handling Asynchronous Errors below.
trace("SUCCESS!");
} catch(error:IOError) {
trace("I/O Error:", error.message);
} catch(error:SecurityError) {
trace("Security Error:", error.message);
} finally {
s.close();
}
}
}
}