Sending Data : Socket « Network « Flash / Flex / ActionScript






Sending Data

 

package{
  import flash.display.Sprite;
  import flash.net.*;
  public class Main extends Sprite{
    public function Main(){
        var socket:Socket = new Socket(  );
        socket.writeMultiByte("example", "unicode");
        socket.writeUTFBytes("USER exampleUsername\n");
        
        socket.writeByte(1);
        socket.writeByte(5);
        socket.writeByte(4);
        socket.writeByte(8);
        socket.flush(  );
    }
  }
}

        








Related examples in the same category

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