Connecting to a Socket Server
package {
import flash.display.Sprite;
import flash.events.*;
import flash.net.Socket;
public class Main extends Sprite {
private var socket:Socket;
public function Main( ) {
socket = new Socket( );
socket.addEventListener( Event.CONNECT, onConnect );
socket.connect( "localhost", 2900 );
}
private function onConnect( event:Event ):void {
trace( "The socket is now connected..." );
}
}
}
Related examples in the same category