diff --git a/examples/iec61850_client_example_files/client_example_files.c b/examples/iec61850_client_example_files/client_example_files.c index 7d369269..a04d6b42 100644 --- a/examples/iec61850_client_example_files/client_example_files.c +++ b/examples/iec61850_client_example_files/client_example_files.c @@ -29,6 +29,7 @@ downloadHandler(void* parameter, uint8_t* buffer, uint32_t bytesRead) if (bufferPosition + bytesRead < MAX_BUFFER_SIZE) { memcpy(downloadBuffer + bufferPosition, buffer, bytesRead); + bufferPosition = bufferPosition + bytesRead; return true; } else @@ -81,7 +82,8 @@ int main(int argc, char** argv) { directoryEntry = LinkedList_getNext(directoryEntry); } - + bufferPosition = 0; + /* Download a file from the server */ IedConnection_getFile(con, &error, "IEDSERVER.BIN", downloadHandler, NULL);