Handling a Built-in Exception : Socket « Network « Flash / Flex / ActionScript






Handling a Built-in Exception

 

package{
  import flash.display.Sprite;
  
  public class Main extends Sprite{
    public function Main(){

        var socket:Socket = new Socket(  );
        
        try {
          socket.connect("example.com", userPort);
        } catch (e:SecurityError) {
        }
    }
  }
}

        








Related examples in the same category

1.Connecting to a Socket Server
2.Receiving Data
3.Sending Data
4.Handling Asynchronous Errors: IOErrorEvent
5.Close the Socket in Finally branch