anpassungen sessionID, TODO chartAt(' ') bug
This commit is contained in:
parent
19073b4f97
commit
f669af74f7
@ -51,7 +51,7 @@ class BufferedNetworkStack {
|
||||
private ArrayList<Element> temp;
|
||||
|
||||
public BufferedNetworkStack(final int port) throws IOException {
|
||||
|
||||
|
||||
stack = new Stack<String>();
|
||||
temp = new ArrayList<Element>();
|
||||
|
||||
@ -81,14 +81,14 @@ class BufferedNetworkStack {
|
||||
String info = BUF_SIZE + "," + stack.size();
|
||||
|
||||
// TODO: Pick better ID
|
||||
int id = temp.size();
|
||||
int id = stack.size();
|
||||
temp.add(id, new Element(size, id));
|
||||
|
||||
send(info, client);
|
||||
break;
|
||||
|
||||
case MessageType.CMD_DATA:
|
||||
int session_id = Integer.valueOf(strReceived.charAt(1));
|
||||
int session_id = Integer.valueOf(strReceived.charAt(1)); //TODO: chartAT(' ') wirft exception bei LEerzeichen
|
||||
int chunk_id = Integer.valueOf(strReceived.charAt(2));
|
||||
|
||||
String data = strReceived.substring(3);
|
||||
|
||||
@ -48,6 +48,7 @@ public class BufferedNetworkStackClient {
|
||||
channel.configureBlocking(true);
|
||||
|
||||
byte[] receivedData = buf.array();
|
||||
|
||||
String infoPacket = new String(receivedData).trim();
|
||||
|
||||
// 0 = buffer_size, 1 = id
|
||||
@ -55,7 +56,7 @@ public class BufferedNetworkStackClient {
|
||||
int remoteBufSize = Integer.valueOf(info[0]);
|
||||
int sessionId = Integer.valueOf(info[1]);
|
||||
|
||||
System.out.println('4');
|
||||
//System.out.println('4');
|
||||
sendChunks(s, dest, remoteBufSize, sessionId);
|
||||
}
|
||||
|
||||
@ -78,7 +79,9 @@ public class BufferedNetworkStackClient {
|
||||
|
||||
int chunkStart = chunkId * lenData;
|
||||
|
||||
buf.put(s.substring(chunkStart, chunkStart + lenData).getBytes());
|
||||
String str = sessionId + chunkId + s.substring(chunkStart, chunkStart + lenData);
|
||||
|
||||
buf.put(str.getBytes());
|
||||
buf.flip();
|
||||
|
||||
try {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user