Open igor-- opened 11 years ago
Thanks igor, would you be able to submit a pull request?
Hi !
For me it was learning task. Really I make clone:
You free use the code as you want (MIT licence)
Please see attachment
Regards, Igor
On Tue, May 28, 2013 at 12:49 AM, Eric Butler notifications@github.comwrote:
Thanks igor, would you be able to submit a pull request?
— Reply to this email directly or view it on GitHubhttps://github.com/codebutler/android-websockets/issues/10#issuecomment-18515911 .
Hi @igor--, your attachment appears to be missing? thanks.
Opps,
In attachment was sources in zip file !
Seems the mail have some filters How I can send it ?
Or maybe really submit it as clone in github ?
Igor
On Tue, May 28, 2013 at 8:09 PM, Eric Butler notifications@github.comwrote:
Hi @igor-- https://github.com/igor--, your attachment appears to be missing? thanks.
— Reply to this email directly or view it on GitHubhttps://github.com/codebutler/android-websockets/issues/10#issuecomment-18565053 .
a pull request is definitely easiest for me, cheers. https://help.github.com/articles/creating-a-pull-request
On Tue, May 28, 2013 at 10:57 AM, igor-- notifications@github.com wrote:
Opps,
In attachment was sources in zip file !
Seems the mail have some filters How I can send it ?
Or maybe really submit it as clone in github ?
Igor
On Tue, May 28, 2013 at 8:09 PM, Eric Butler notifications@github.comwrote:
Hi @igor-- https://github.com/igor--, your attachment appears to be missing? thanks.
— Reply to this email directly or view it on GitHub< https://github.com/codebutler/android-websockets/issues/10#issuecomment-18565053>
.
— Reply to this email directly or view it on GitHubhttps://github.com/codebutler/android-websockets/issues/10#issuecomment-18568306 .
Hi Eric !
I create new project and commit the sources, please see:
https://github.com/igor--/tinywebsocket
Regards, Igor
On Tue, May 28, 2013 at 9:01 PM, Eric Butler notifications@github.comwrote:
a pull request is definitely easiest for me, cheers. https://help.github.com/articles/creating-a-pull-request
On Tue, May 28, 2013 at 10:57 AM, igor-- notifications@github.com wrote:
Opps,
In attachment was sources in zip file !
Seems the mail have some filters How I can send it ?
Or maybe really submit it as clone in github ?
Igor
On Tue, May 28, 2013 at 8:09 PM, Eric Butler notifications@github.comwrote:
Hi @igor-- https://github.com/igor--, your attachment appears to be missing? thanks.
— Reply to this email directly or view it on GitHub<
https://github.com/codebutler/android-websockets/issues/10#issuecomment-18565053>
.
— Reply to this email directly or view it on GitHub< https://github.com/codebutler/android-websockets/issues/10#issuecomment-18568306>
.
— Reply to this email directly or view it on GitHubhttps://github.com/codebutler/android-websockets/issues/10#issuecomment-18568564 .
Thanks! I'll look into integrating your work. I had considered removing the Android-specific code, I like the name "tinywebsockets".
OK Thanks.
On Tue, May 28, 2013 at 9:54 PM, Eric Butler notifications@github.comwrote:
Thanks! I'll look into integrating your work. I had considered removing the Android-specific code, I like the name "tinywebsockets".
— Reply to this email directly or view it on GitHubhttps://github.com/codebutler/android-websockets/issues/10#issuecomment-18571924 .
you use double arithmetic in the code (seems it's java script way But in Java we can work with bits fields. So instead: frame[1] = (byte) (masked | 127); frame[2] = (byte) (((int) Math.floor(length / Math.pow(2, 56))) & BYTE); frame[3] = (byte) (((int) Math.floor(length / Math.pow(2, 48))) & BYTE); frame[4] = (byte) (((int) Math.floor(length / Math.pow(2, 40))) & BYTE); frame[5] = (byte) (((int) Math.floor(length / Math.pow(2, 32))) & BYTE); frame[6] = (byte) (((int) Math.floor(length / Math.pow(2, 24))) & BYTE); frame[7] = (byte) (((int) Math.floor(length / Math.pow(2, 16))) & BYTE); frame[8] = (byte) (((int) Math.floor(length / Math.pow(2, 8))) & BYTE); frame[9] = (byte) (length & BYTE);
can be used: frame[1] = (byte) (masked | 127); //frame[2] = (byte) (0); //frame[3] = (byte) (0); //frame[4] = (byte) (0); //frame[5] = (byte) (0); frame[6] = (byte) ((length >> 24) & 0xFF); frame[7] = (byte) ((length >> 16) & 0xFF); frame[8] = (byte) ((length >> 8) & 0xFF); frame[9] = (byte) (length & 0xFF);
you can use DataInputStream standard function to read 2 and 8 bytes integer, likes: length = stream.readUnsignedShort(); // read 2 bytes length
long length8 = stream.readLong(); // read 8 bytes length if( length8 > Integer.MAX_VALUE ) throw new IOException("too big frame length"); length = (int)length8;
instead of your method: byteArrayToLong()