static public function hex_to_ascii(sText:String):String {
var thisHexChar:String;
var retString:String = "";
for (var i:int =0; i < sText.length/2; i++) {
thisHexChar = sText.charAt(i*2).toString() +
sText.charAt((i*2)+1).toString();
thisHexChar = "0x" + thisHexChar;
retString = retString +
String.fromCharCode(int(thisHexChar));
}
return retString;
}
I've this function to convert HEX to ASCII, but when i send a packet with
Socket.writeUTFBytes
this packet go wrong with wrongvalues
Example:
I send: TCP_Sock.writeUTFBytes(
hex_to_ascii(
"3c000000c1c8df4affffffffd40700000000000061646d696e2e24636d64000000000001000000150000001077686174736d79757269000100000000"
)
)
And i see with wireshark the hex value sended was:
3c000000c381c388c39f4ac3bfc3bfc3bfc3bfc3940700000000000061646d696e2e24636d64000000000001000000150000001077686174736d79757269000100000000
I dont know how to fix this... can some one helpme pls?
_______________________________________________
Flashcoders mailing list
[email protected]
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders