WIP: Worked on new server thread class that would create and store multiple THREADS of connections. Researched Authorative server structures.

Fixed the current structure of the server to work with the old StreamReciever style and hook up to the Stream Parser

tags: #story[1047] pair[wmu16, mra106]
This commit is contained in:
William Muir
2017-07-14 17:09:33 +12:00
parent 5b908ec355
commit 77e7db79cc
8 changed files with 244 additions and 161 deletions
@@ -194,6 +194,25 @@ public abstract class Message {
return data;
}
/**
* takes an array of up to 7 bytes in little endian format and
* returns a positive long constructed from the input bytes
*
* @return a positive long if there is less than 8 bytes -1 otherwise
*/
public static long bytesToLong(byte[] bytes){
long partialLong = 0;
int index = 0;
for (byte b: bytes){
if (index > 6){
return -1;
}
partialLong = partialLong | (b & 0xFFL) << (index * 8);
index++;
}
return partialLong;
}
/**
* Reverse an array of bytes
* @param data The byte[] to reverse
@@ -205,4 +224,5 @@ public abstract class Message {
data[right] = (byte) (temp & 0xff);
}
}
}