[Update: DjangoAMF has been patched with these changes. Thanks!]
Immediately after I installed DjangoAMF and began playing around I ran into problems. Nothing was working correctly, even though my setup was exactly as the example in the user manual, and Flex was constantly rewarding me with a Client.Data.UnderFlow
exception.
I could get the same Flex 2 application working with a gateway running amfphp (which I installed as a control/reference), so I was pretty sure it wasn’t the Flex side of things.
So I began peeking at the transmitted packets with Charles and comparing it to the structure of the remoting envelope. Soon I noticed something a bit, shall we say, dyslexic…
Hmm.
*checks DjangoAMF Python code*
Dang.
Haven’t run into this issue in years. Looks like I ran into this issue for the first time because I am running/testing on my non-Intel Powerbook thus breaking the network byte ordering for me.
A quick python fix and test of the changes confirmed my suspicions. Here’s the fix:
In amf/amf0.py, replace
def write_long(l, output):
d = struct.pack('L', l)
d = d[::-1]
output.write(d)
def write_int(n, output):
d = struct.pack('H', n)
d = d[::-1]
output.write(d)
with
def write_int(n, output):
output.write(struct.pack('H', socket.htons(n)))
def write_long(l, output):
output.write(struct.pack('L', socket.htonl(l)))
I hope this helps any other Mac programmers who might be struggling with getting this to work; getting these two frameworks running together is a real pleasure to behold. Stay tuned.
March 16, 2007 at 11:53 am |
Thank you for your report. I released the newer version of Django AMF including your fix.
March 16, 2007 at 6:02 pm |
Awesome – thanks!
October 24, 2007 at 5:36 pm |
Wow! you article make great idea to me.Thank a lot.
November 5, 2007 at 5:08 pm |
Ah, probably it was this change which caused this bug:
http://sourceforge.jp/tracker/index.php?func=detail&aid=11168&group_id=2585&atid=9591
which apparently has been fixed in 0.5.5.