Ignore:
Timestamp:
Aug 2, 2010, 9:27:30 PM (15 years ago)
Author:
Dmitry A. Kuminov
Message:

trunk: Merged in qt 4.6.3 sources from branches/vendor/nokia/qt.

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk

  • trunk/examples/network/loopback/dialog.cpp

    r651 r769  
    4545#include "dialog.h"
    4646
    47 #if !defined(Q_OS_WINCE)
     47#if !defined(Q_OS_WINCE)
    4848static const int TotalBytes = 50 * 1024 * 1024;
    4949#else
    5050static const int TotalBytes = 5 * 1024 * 1024;
    5151#endif
    52 static const int PayloadSize = 65536;
     52static const int PayloadSize = 6
    5353
    5454Dialog::Dialog(QWidget *parent)
     
    131131void Dialog::startTransfer()
    132132{
     133
    133134    bytesToWrite = TotalBytes - (int)tcpClient.write(QByteArray(PayloadSize, '@'));
    134135    clientStatusLabel->setText(tr("Connected"));
     
    156157void Dialog::updateClientProgress(qint64 numBytes)
    157158{
     159
    158160    bytesWritten += (int)numBytes;
    159     if (bytesToWrite > 0)
     161
     162    // only write more if not finished and when the Qt write buffer is below a certain size.
     163    if (bytesToWrite > 0 && tcpClient.bytesToWrite() <= 4*PayloadSize)
    160164        bytesToWrite -= (int)tcpClient.write(QByteArray(qMin(bytesToWrite, PayloadSize), '@'));
    161165
Note: See TracChangeset for help on using the changeset viewer.