public void sendBlock(IByteBuffer data, Response response) { int sendId = getNextId(); IByteBuffer message = ByteBufferManager.Instance.GetObj(); int pos = data.getReadPos(); message.writeByte(data.readByte()); message.writeInt(sendId); message.writeByteBuffer(data, data.available()); data.setReadPos(pos); responses[sendId] = response; con.send(message); }
public void processMessage(IByteBuffer data) { if (data.available() <= 0) { return; } int id = data.readByte(); if (id == 0) { onBlock(data); } else { data.setReadPos(data.getReadPos() - 1); //messageArrived(data); } }