Changeset 937 in ntrip


Ignore:
Timestamp:
Jun 8, 2008, 5:48:54 PM (16 years ago)
Author:
mervart
Message:

* empty log message *

Location:
trunk/BNC
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/BNC/bncapp.cpp

    r936 r937  
    9898  _sockets = 0;
    9999
     100  _portCorr    = 0;
     101  _serverCorr  = 0;
     102  _socketsCorr = 0;
     103
    100104  _pgmName  = _bncVersion.leftJustified(20, ' ', true);
    101105#ifdef WIN32
     
    117121  delete _server;
    118122  delete _sockets;
     123  delete _serverCorr;
     124  delete _socketsCorr;
    119125  if (_rinexVers == 2) {
    120126    delete _ephStreamGlonass;
     
    555561}
    556562
     563// Set Port Number
     564////////////////////////////////////////////////////////////////////////////
     565void bncApp::setPortCorr(int port) {
     566  _portCorr = port;
     567  if (_portCorr != 0) {
     568    _serverCorr = new QTcpServer;
     569    _serverCorr->listen(QHostAddress::Any, _portCorr);
     570    connect(_serverCorr, SIGNAL(newConnection()), this, SLOT(slotNewConnectionCorr()));
     571    _socketsCorr = new QList<QTcpSocket*>;
     572  }
     573}
     574
    557575// New Connection
    558576////////////////////////////////////////////////////////////////////////////
    559577void bncApp::slotNewConnection() {
    560578  _sockets->push_back( _server->nextPendingConnection() );
     579}
     580
     581// New Connection
     582////////////////////////////////////////////////////////////////////////////
     583void bncApp::slotNewConnectionCorr() {
     584  _socketsCorr->push_back( _serverCorr->nextPendingConnection() );
    561585}
    562586
     
    569593}
    570594
    571 
    572595//
    573596////////////////////////////////////////////////////////////////////////////
    574597void bncApp::slotNewCorrLine(QString line) {
    575   cout << line.toAscii().data() << endl;
    576 }
     598  if (_socketsCorr) {
     599    QMutableListIterator<QTcpSocket*> is(*_socketsCorr);
     600    while (is.hasNext()) {
     601      QTcpSocket* sock = is.next();
     602      if (sock->state() == QAbstractSocket::ConnectedState) {
     603        if (sock->write(line.toAscii()) == -1) {
     604          delete sock;
     605          is.remove();
     606        }
     607      }
     608      else if (sock->state() != QAbstractSocket::ConnectingState) {
     609        delete sock;
     610        is.remove();
     611      }
     612    }
     613  }
     614}
  • trunk/BNC/bncapp.h

    r936 r937  
    3939    virtual ~bncApp(); 
    4040    QString bncVersion() const {return _bncVersion;}
    41     void    setPort(int port);
     41    void setPort(int port);
     42    void setPortCorr(int port);
    4243    void setCaster(bncCaster* caster) {_caster = caster;}
    4344  public slots:
     
    5051 private slots:
    5152   void slotNewConnection();
     53   void slotNewConnectionCorr();
    5254  private:
    5355    void printEphHeader();
     
    7476    QTcpServer*         _server;
    7577    QList<QTcpSocket*>* _sockets;
     78    int                 _portCorr;
     79    QTcpServer*         _serverCorr;
     80    QList<QTcpSocket*>* _socketsCorr;
    7681    bncCaster*          _caster;
    7782};
  • trunk/BNC/bncmain.cpp

    r728 r937  
    126126
    127127    app.setPort(settings.value("outEphPort").toInt());
     128    app.setPortCorr(settings.value("corrPort").toInt());
    128129
    129130    app.connect(caster, SIGNAL(getThreadErrors()), &app, SLOT(quit()));
  • trunk/BNC/bncwindow.cpp

    r934 r937  
    638638
    639639  ((bncApp*)qApp)->setPort(_outEphPortLineEdit->text().toInt());
     640  ((bncApp*)qApp)->setPortCorr(_corrPortLineEdit->text().toInt());
    640641
    641642  connect(_caster, SIGNAL(getThreadErrors()),
Note: See TracChangeset for help on using the changeset viewer.