Changeset 1229 in ntrip


Ignore:
Timestamp:
Nov 22, 2008, 5:10:28 PM (16 years ago)
Author:
mervart
Message:

* empty log message *

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/BNC/bnccaster.cpp

    r1228 r1229  
    483483////////////////////////////////////////////////////////////////////////////
    484484int bncCaster::myWrite(QTcpSocket* sock, const char* buf, int bufLen) {
    485   int bytesWritten = 0;
    486   for (;;) {
    487     int newBytes = sock->write(buf+bytesWritten, bufLen-bytesWritten);
    488     if (newBytes < 0) {
    489       return newBytes;
    490     }
    491     else {
    492       bytesWritten += newBytes;
    493     }
    494     if (bytesWritten == bufLen) {
    495       return bytesWritten;
    496     }
    497   }
    498 }
     485  sock->write(buf, bufLen);
     486  for (int ii = 1; ii <= 10; ii++) {
     487    if (sock->waitForBytesWritten(10)) {  // wait 10 ms
     488      return bufLen;
     489    }
     490  }
     491  return -1;
     492}
Note: See TracChangeset for help on using the changeset viewer.