Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var blockSize:int = 4096;
- var startPoint:int = 0;
- var length:int = ba.length;
- var sendDatalength:int;
- var block:ByteArray;
- var blockCount:uint = 0;
- // debug
- var debugBA:ByteArray = new ByteArray;
- // end debug
- while (startPoint < length)
- {
- sendDatalength = blockSize;
- if (startPoint + sendDatalength > length)
- {
- sendDatalength = length - startPoint;
- }
- block = new ByteArray;
- block.writeByte(1);
- block.writeByte(2);
- block.writeByte(3);
- block.writeByte(4);
- block.writeByte(5);
- block.writeByte(6);
- block.writeByte(7);
- block.writeByte(8);
- block.writeByte(9);
- block.writeByte(10);
- block.writeUnsignedInt(blockCount);
- block.writeBytes(ba, startPoint, sendDatalength);
- // debug
- debugBA.writeBytes(block)
- // end debug
- clientSocket.writeBytes(block);
- clientSocket.flush();
- startPoint += sendDatalength;
- blockCount++;
- }
- //// start debug
- var path:String = "D:\\tempBase64\\" + "test" + ".bytearray";
- var ff:File = new File(path);
- var fs:FileStream = new FileStream();
- fs.open(ff, FileMode.WRITE);
- fs.writeBytes(debugBA, 0, debugBA.length);
- fs.close();
- //// end debug
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement