Binary Socket

Hello,

Everyone claims that they have a binary socket using the Socket() class but I havent found any that work properly.

I have tried var sData = socket.readUTFBytes(sock.bytesAvailable); which works fine for plain text, but when you send it binary it doesnt work. (sData.length = 0)

I have also tried socket.readBytes(sReceive, 0, socket.bytesAvailable); and then convertered to a string. I thought this method was working but it turns out its not because a Byte in AS3 = -128 to 127. So when you encode a binary character (From 0 to 255) AS3 displays garbage when it gets a value higher then 127. Since the server cant encode binary from -128 to 127 because its ASCII. Has anyone run into this?

Thanks