Changeset 1375 in ntrip
- Timestamp:
- Dec 28, 2008, 10:04:16 PM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
TabularUnified trunk/BNC/bnctabledlg.cpp ¶
r1373 r1375 44 44 #include "bncgetthread.h" 45 45 #include "bncnetquery.h" 46 #include "bncsocket.h"47 46 48 47 using namespace std; … … 169 168 url.setHost(casterHost); 170 169 url.setPort(casterPort); 171 172 // Send the Request 173 // ---------------- 174 const int timeOut = 10*1000; 175 QString msg; 176 bncSocket* socket = new bncSocket(); 177 178 //// beg test 179 bncNetQuery* query = new bncNetQuery(); 170 url.setScheme("http"); 171 url.setPath("/"); 172 173 bncNetQuery query; 180 174 QByteArray outData; 181 cout << "before request" << endl; 182 t_irc irc = query->waitForRequestResult(url, outData); 183 cout << "after request " << irc << endl; 184 cout << outData.data(); 185 return failure; 186 //// end test 187 188 if (socket->request(url, "", "", "", ntripVersion, timeOut, msg) != success) { 189 delete socket; 175 query.waitForRequestResult(url, outData); 176 if (query.status() == bncNetQuery::finished) { 177 QTextStream in(outData); 178 QString line = in.readLine(); 179 while ( !line.isNull() ) { 180 allLines.append(line); 181 line = in.readLine(); 182 } 183 allTables.insert(casterHost, allLines); 184 return success; 185 } 186 else { 190 187 return failure; 191 188 } 192 193 // Read Caster Response194 // --------------------195 bool proxyRespond = false;196 bool first = true;197 while (true) {198 if (socket->canReadLine()) {199 QString line = socket->readLine();200 201 // Skip messages from proxy server202 // -------------------------------203 if (line.indexOf("SOURCETABLE 200 OK") == -1 &&204 line.indexOf("200 OK") != -1 ) {205 proxyRespond = true;206 }207 if (proxyRespond) {208 if (line.trimmed().isEmpty()) {209 proxyRespond = false;210 }211 continue;212 }213 214 allLines.push_back(line);215 if (first) {216 first = false;217 if (line.indexOf("SOURCETABLE 200 OK") != 0) {218 if (ntripVersion == "1") {219 break;220 }221 }222 }223 else {224 if (line.indexOf("ENDSOURCETABLE") == 0) {225 break;226 }227 }228 }229 else {230 socket->waitForReadyRead(timeOut);231 if (socket->bytesAvailable() > 0) {232 continue;233 }234 else {235 break;236 }237 }238 }239 /// delete socket;240 241 allTables.insert(casterHost, allLines);242 return success;243 189 } 244 190
Note:
See TracChangeset
for help on using the changeset viewer.