二进制数据从php通过http损坏到AS3 [英] Binary data corrupted from php to AS3 via http

查看:81
本文介绍了二进制数据从php通过http损坏到AS3的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试通过HTTP从PHP服务器使用AS3检索二进制数据,但是很多时候(〜50%)一些字节损坏了.

I'm trying to retrieve binary data using AS3 from a PHP server via HTTP, but very often (~50%) a few bytes arrive corrupted.

PHP代码段:

header('Content-Type:binary/octet-stream;');

echo $this->page;

AS3代码段:

var resp:int=data.readByte();
var user_id:uint=data.readUnsignedInt();
var anon_id:uint=data.readUnsignedInt();
var token:ByteArray=new ByteArray();
data.readBytes(token,0,16);


示例,发送的数据在第一行,接收的数据在第二行(添加了可读性的空间):


Examples, with the sent data in the first line, and the received data in the second line (spaces added for readability):

01000000110000000095cb4bca40fb d0bb ab7bdd15b3e973c7
01000000110000000095cb4bca40fb 3b   ab7bdd15b3e973c7

010000001200000000bb5c4c55af caa9e9afd6 a7f550748b61
010000001200000000bb5c4c55af a9e9af     a7f550748b61

010000001400000000e191ffbc222d239debe 8d69 0d93b7ca4
010000001400000000e191ffbc222d239debe 89   0d93b7ca4

0100000017000000002e1b75 db89 8a1a cd86 f05a8bf07c592b
0100000017000000002e1b75 c9   8a1a 46   f05a8bf07c592b

010000001a00000000b4d72a3a8cd b944 5d0559072d8d16583
010000001a00000000b4d72a3a8cd 44   5d0559072d8d16583

010000001e000000007 bc8a 377bd9feab432260d43db4a42ab
010000001e000000007 b2   377bd9feab432260d43db4a42ab

推荐答案

虽然我仍然不知道发生了什么,但是我却避免了以纯文本/文本格式传输十六进制编码数据的问题.

While I still have no idea what was happening, I dodged the problem transmitting hex encoded data in plain/text.

这篇关于二进制数据从php通过http损坏到AS3的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆