Changeset 829 in ntrip for trunk/BNS/bnseph.cpp


Ignore:
Timestamp:
Apr 15, 2008, 10:24:31 AM (16 years ago)
Author:
mervart
Message:

* empty log message *

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/BNS/bnseph.cpp

    r817 r829  
    2626////////////////////////////////////////////////////////////////////////////
    2727t_bnseph::t_bnseph(QObject* parent) : QThread(parent) {
    28   _socket = 0;
     28
     29  QSettings settings;
     30  QString host = "localhost";
     31  int     port = settings.value("ephPort").toInt();
     32
     33  _socket = new QTcpSocket();
     34  _socket->connectToHost(host, port);
     35
     36  const int timeOut = 3*1000;  // 3 seconds
     37  if (!_socket->waitForConnected(timeOut)) {
     38    emit(error("bnseph::run Connect Timeout"));
     39  }
    2940}
    3041
     
    4152  emit(newMessage("bnseph::run Start"));
    4253
    43   // Connect the Socket
    44   // ------------------
    45   QSettings settings;
    46   QString host = "localhost";
    47   int     port = settings.value("ephPort").toInt();
    48 
    49   _socket = new QTcpSocket();
    50   _socket->connectToHost(host, port);
    51 
    52   const int timeOut = 3*1000;  // 3 seconds
    53   if (!_socket->waitForConnected(timeOut)) {
    54     emit(error("bnseph::run Connect Timeout"));
    55   }
    56   else {
    57     while (true) {
    58       if (_socket->state() != QAbstractSocket::ConnectedState) {
    59         emit(error("bnseph::not connected"));
    60         break;
    61       }
    62       if (_socket->canReadLine()) {
    63         readEph();
    64       }
    65       else {
    66         _socket->waitForReadyRead(10);
    67       }
     54  while (true) {
     55    if (_socket->state() != QAbstractSocket::ConnectedState) {
     56      emit(error("bnseph::not connected"));
     57      break;
     58    }
     59    if (_socket->canReadLine()) {
     60      readEph();
     61    }
     62    else {
     63      _socket->waitForReadyRead(10);
    6864    }
    6965  }
Note: See TracChangeset for help on using the changeset viewer.