views:

698

answers:

1

I write a chat server in c++ and a flash client in flex3.
the message exchanged between them is like [message_len+messagebody]
where the flash open on my owner windows xp system,it works ok,the message sent and recieved is right.
but when I put the flash on a red hat 5 's apache server, try to open it in the web browers, the flash socket send error messages,the message can not be recognized.
at first ,I think is maybe the endian is not the same, at first,I use the littlendian. so ,I try the bigendian, but this time it's not work even on the local xp system. and from the c++ server ,I can see this time both the local and the remote flash, it's got the same data,but not the same with the flash sent, I think it because of the bigendian .

so the situation is this: I use the littleendian, the flash client works good on the local xp system,ie 7 explorer. but it's not ok if I put it on a red hat 5's apache server. I also try a ror's mongrel server,it's work the same way.... and if i save the flash from the web browser, I found the filesize is not equal with the local flash filesize;

if I use the bigendian,the flash client works bad both the local or the remote... the reason should be the bigendian is not ok for the radhat5 .

so ,anybody can help me ? thanks a lot.

+1  A: 

It all depends on how you read the message length from the socket. If it's not a little/big endian issue, maybe the server is a 64-bit system and you try to read 64-bit (=8 byte) from the socket as the message length, while your flash on your 32-bit system just sends 32 bit (=4 byte)? That would lead to confusion...

Does the server read a crazily large message length (>5.000.000.000)? This would hint to a 64-bit number. If the message length read by the server is smaller, but still much too large (like 1.000.000.000 or 1.000.000) it's probably an endian issue. If the message size is about correct, the problem is due to something else...

sth
I try the sizeof(int) ont the server,it's return 4. I just open a python socket server and try the flash to connect to it.and I receive this message "<policy-file-request/>" ,now it should be the Security problem.
the flex socket will auto send "<policy-file-request/>" when it connected to a different domain server. and the server should send back something like this..<cross-domain-policy><allow-access-from domain=\"*\" to-ports=\"*\"/></cross-domain-policy>\0
thank you any way. If I found a better solution I will write it here.
That explains the problem.... Much better than having to fiddle around with little/big endian conversions!
sth