-
Notifications
You must be signed in to change notification settings - Fork 176
Open
Labels
Description
My code looks like:
socket = new Socket(host, port);
streamOut = new BufferedOutputStream(socket.getOutputStream());
byte[] b = new byte[] { 0x33, 0x66, (byte) 0x99, (byte) 0xcc };
streamOut.write(b);
This results into sending ONE byte (which is 0x00) instead of the FOUR bytes.
Having a look into websock.js I noticed a problem in the following function:
function send(arr) {
Util.Debug(">> send_array: " + arr);
sQ = sQ.concat(arr);
return flush();
}
sQ is an empty array, while arr is an Uint8Array. Therefore sQ.concat(arr) results into an array with ONE entry which is the complete Uint8Array arr (and not in an array with 4 entries).
I changed the send function for my testing:
function send(arr) {
Util.Debug(">> send_array: " + arr);
// sQ = sQ.concat(arr);
for (var i=0; i<arr.length; i++) {
sQ.push(arr[i]);
}
return flush();
}
I think, that doppio should take care, that the parameter "arr" is of type array and not Unint8Array.
Reactions are currently unavailable