Close the Socket in Finally branch
package
{
import flash.display.Sprite;
import flash.errors.IOError;
import flash.net.Socket;
public class Main extends Sprite
{
public function Main()
{
try
{
var s:Socket = new Socket();
s.connect("http://www.cmu.edu/", 80);
} catch(error:IOError) {
trace("I/O Error:", error.message);
} catch(error:SecurityError) {
trace("Security Error:", error.message);
} finally {
s.close();
}
}
}
}
Related examples in the same category