public void ChunkPartArrived(int chunkPartId, byte[] chunkPart) { lock (received) { if (!received.Get(chunkPartId)) { Received.Set(chunkPartId, true); numberOfReceived++; Buffer.BlockCopy(chunkPart, 0, data, chunkPartId * Sizes.ChunkPartSize, chunkPart.Length); Debug.WriteLine("chunk " + chunkId + " PRIMIO: " + numberOfReceived + "/" + chunkChunkNumbers); if (numberOfReceived == chunkChunkNumbers) { endPointManager.ChunkFinished(ChunkId, Data); } } } }