Changeset 1367 in ntrip for trunk/BNC/bncsocket.cpp


Ignore:
Timestamp:
Dec 27, 2008, 11:22:13 PM (16 years ago)
Author:
mervart
Message:

* empty log message *

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/BNC/bncsocket.cpp

    r1366 r1367  
    55 * Class:      bncSocket
    66 *
    7  * Purpose:    Combines QTcpSocket (NTRIP v1) and  QNetworkReply (NTRIP v2)
     7 * Purpose:    Combines QTcpSocket (NTRIP v1) and QHttp (NTRIP v2)
    88 *
    99 * Author:     L. Mervart
     
    1717#include <iostream>
    1818#include <iomanip>
     19
     20#include <string.h>
    1921
    2022#include "bncsocket.h"
     
    4648////////////////////////////////////////////////////////////////////////////
    4749QAbstractSocket::SocketState bncSocket::state() const {
    48   if (_socket) {
     50  if      (_http) {
     51    if (_http->state() != QHttp::Unconnected) {
     52      return QAbstractSocket::ConnectedState;
     53    }
     54    else {
     55      return QAbstractSocket::UnconnectedState;
     56    }
     57  }
     58  else if (_socket) {
    4959    return _socket->state();
    5060  }
     
    136146////////////////////////////////////////////////////////////////////////////
    137147qint64 bncSocket::read(char* data, qint64 maxlen) {
    138   if (_socket) {
     148  if      (_http) {
     149    strncpy(data, _buffer.data(), maxlen);
     150    _buffer = _buffer.right(_buffer.size()-maxlen);
     151    return maxlen;
     152  }
     153  else if (_socket) {
    139154    return _socket->read(data, maxlen);
    140155  }
Note: See TracChangeset for help on using the changeset viewer.