Socket read methods for various datatypespackage { import flash.display.Sprite; import flash.events.ProgressEvent; import flash.net.Socket; public class SocketExample extends Sprite { private var socket:Socket; public function SocketExample( ) { socket = new Socket( ); socket.addEventListener( ProgressEvent.SOCKET_DATA, onSocketData ); socket.connect( "localhost", 2900 ); } private function onSocketData( event:ProgressEvent ):void { trace( "Socket received " + socket.bytesAvailable + " byte(s) of data:" ); while ( socket.bytesAvailable ) { var data:int = socket.readByte( ); trace( data ); } } }}
Name (required)
email (will not be published) (required)
Website