diff --git a/ApplicationCode/SocketInterface/RiaPropertyDataCommands.cpp b/ApplicationCode/SocketInterface/RiaPropertyDataCommands.cpp index 385ee7603d..1d1b1b5420 100644 --- a/ApplicationCode/SocketInterface/RiaPropertyDataCommands.cpp +++ b/ApplicationCode/SocketInterface/RiaPropertyDataCommands.cpp @@ -146,7 +146,7 @@ public: socketStream << timestepByteCount ; // Then write the data. - size_t valueCount = RiaSocketDataTransfer::doubleValueCountInBlock(); + size_t valueCount = RiaSocketDataTransfer::maximumValueCountInBlock(); std::vector values(valueCount); size_t valueIndex = 0; @@ -315,7 +315,7 @@ public: continue; } - size_t valueCount = RiaSocketDataTransfer::doubleValueCountInBlock(); + size_t valueCount = RiaSocketDataTransfer::maximumValueCountInBlock(); std::vector values(valueCount); size_t valueIndex = 0; for (size_t cellIdx = 0; cellIdx < rigGrid->cellCount(); cellIdx++) diff --git a/ApplicationCode/SocketInterface/RiaSocketDataTransfer.cpp b/ApplicationCode/SocketInterface/RiaSocketDataTransfer.cpp index 8671f2e28d..0d2ec8879f 100644 --- a/ApplicationCode/SocketInterface/RiaSocketDataTransfer.cpp +++ b/ApplicationCode/SocketInterface/RiaSocketDataTransfer.cpp @@ -27,7 +27,7 @@ bool RiaSocketDataTransfer::writeBlockDataToSocket(QTcpSocket* socket, const cha quint64 bytesWritten = 0; int blockCount = 0; - quint64 maxBlockSize = doubleValueCountInBlock() * sizeof(double); + quint64 maxBlockSize = maximumValueCountInBlock() * sizeof(double); while (bytesWritten < bytesToWrite) { @@ -57,11 +57,14 @@ bool RiaSocketDataTransfer::readBlockDataFromSocket(QTcpSocket* socket, char* da { quint64 bytesRead = 0; + quint64 maxBlockSize = maximumValueCountInBlock() * sizeof(double); + while (bytesRead < bytesToRead) { if (socket->bytesAvailable()) { quint64 byteCountToRead = bytesToRead - bytesRead; + byteCountToRead = qMin(byteCountToRead, maxBlockSize); qint64 actuallyBytesRead = socket->read(data + bytesRead, byteCountToRead); if (actuallyBytesRead < 0) @@ -73,6 +76,10 @@ bool RiaSocketDataTransfer::readBlockDataFromSocket(QTcpSocket* socket, char* da } bytesRead += actuallyBytesRead; + +#ifdef octave_oct_h + //octave_stdout << "Byte read " << bytesRead << " of a total of "<< bytesToRead << "\n"; +#endif } else { @@ -85,7 +92,7 @@ bool RiaSocketDataTransfer::readBlockDataFromSocket(QTcpSocket* socket, char* da } } -// Allow Octave process to end a long running Octave function + // Allow Octave process to end a long running Octave function #ifdef octave_oct_h OCTAVE_QUIT; #endif @@ -98,8 +105,9 @@ bool RiaSocketDataTransfer::readBlockDataFromSocket(QTcpSocket* socket, char* da //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -size_t RiaSocketDataTransfer::doubleValueCountInBlock() +size_t RiaSocketDataTransfer::maximumValueCountInBlock() { - return 2000; + return 20000; } + diff --git a/ApplicationCode/SocketInterface/RiaSocketDataTransfer.h b/ApplicationCode/SocketInterface/RiaSocketDataTransfer.h index 06ae14b379..7c16beb8aa 100644 --- a/ApplicationCode/SocketInterface/RiaSocketDataTransfer.h +++ b/ApplicationCode/SocketInterface/RiaSocketDataTransfer.h @@ -28,7 +28,7 @@ class RiaSocketDataTransfer { public: - static size_t doubleValueCountInBlock(); + static size_t maximumValueCountInBlock(); public: static bool writeBlockDataToSocket(QTcpSocket* socket, const char* data, quint64 bytesToWrite, QStringList& errorMessages);