Why does AMFPHP store integers as two bytes for the AMF protocol?
I'm wondering if anyone familiar with AMFPHP or low level data storage could explain why integers are being stored as two bytes instead of four. As far as I can tell, the AMF3 protocol demands a four byte integer. The specific code in the serializer is the following:
/**
* writeInt takes an int and writes it as 2 bytes to the output stream
* 0-65535 range
*
* @param int $n An integer to convert to a 2 byte binary string
*/
function writeInt($n) {
$this->outBuffer .= pack("n", $n); // use pack with the n flag
}
I realize this question may be too specific, but can anyone开发者_高级运维 help answer my question?
See here for a quite nice explanation how it works: AMF message structure?
精彩评论