Changeset 1367 in ntrip for trunk/BNC/bncsocket.cpp
- Timestamp:
- Dec 27, 2008, 11:22:13 PM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/BNC/bncsocket.cpp
r1366 r1367 5 5 * Class: bncSocket 6 6 * 7 * Purpose: Combines QTcpSocket (NTRIP v1) and QNetworkReply(NTRIP v2)7 * Purpose: Combines QTcpSocket (NTRIP v1) and QHttp (NTRIP v2) 8 8 * 9 9 * Author: L. Mervart … … 17 17 #include <iostream> 18 18 #include <iomanip> 19 20 #include <string.h> 19 21 20 22 #include "bncsocket.h" … … 46 48 //////////////////////////////////////////////////////////////////////////// 47 49 QAbstractSocket::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) { 49 59 return _socket->state(); 50 60 } … … 136 146 //////////////////////////////////////////////////////////////////////////// 137 147 qint64 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) { 139 154 return _socket->read(data, maxlen); 140 155 }
Note:
See TracChangeset
for help on using the changeset viewer.