- Timestamp:
- Mar 9, 2009, 1:01:29 PM (16 years ago)
- Location:
- trunk/BNC
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
TabularUnified trunk/BNC/bncnetqueryudp.cpp ¶
r1758 r1761 17 17 #include <iostream> 18 18 #include <iomanip> 19 #include <time.h> 19 20 20 21 #include "bncnetqueryudp.h" … … 24 25 25 26 #define BNCVERSION "1.7" 27 #define TIME_RESOLUTION 125 26 28 27 29 // Constructor … … 32 34 _eventLoop = new QEventLoop(this); 33 35 34 _keepAlive = new char[12]; 35 _keepAlive[0] = 128; 36 _keepAlive[1] = 96; 37 for (int jj = 2; jj <= 7; jj++) { 38 _keepAlive[jj] = 0; 36 _keepAlive[ 0] = 128; 37 _keepAlive[ 1] = 96; 38 for (int ii = 2; ii <=11; ii++) { 39 _keepAlive[ii] = 0; 39 40 } 40 int session = rand();41 _keepAlive[8] = (session >> 24) & 0xFF;42 _keepAlive[9] = (session >> 16) & 0xFF;43 _keepAlive[10] = (session >> 8) & 0xFF;44 _keepAlive[11] = (session) & 0xFF;45 41 } 46 42 … … 50 46 delete _eventLoop; 51 47 delete _udpSocket; 52 delete _keepAlive;53 48 } 54 49 … … 64 59 void bncNetQueryUdp::slotKeepAlive() { 65 60 if (_udpSocket) { 66 cout << "slotKeepAlive" << endl;67 61 _udpSocket->writeDatagram(_keepAlive, 12, _address, _port); 68 62 } 69 QTimer::singleShot( 30000, this, SLOT(slotKeepAlive()));63 QTimer::singleShot(15000, this, SLOT(slotKeepAlive())); 70 64 } 71 65 … … 156 150 157 151 _udpSocket->writeDatagram(rtpbuffer, 12 + reqStr.size(), _address, _port); 158 QTimer::singleShot(30000, this, SLOT(slotKeepAlive())); 152 153 // Wait for Reply, read Session Number 154 // ----------------------------------- 155 QByteArray repl; 156 waitForReadyRead(repl); 157 158 QTextStream in(repl); 159 QString line = in.readLine(); 160 while (!line.isEmpty()) { 161 if (line.indexOf("Session:") == 0) { 162 _session = line.mid(9).toInt(); 163 _keepAlive[ 8] = (_session >> 24) & 0xFF; 164 _keepAlive[ 9] = (_session >> 16) & 0xFF; 165 _keepAlive[10] = (_session >> 8) & 0xFF; 166 _keepAlive[11] = (_session) & 0xFF; 167 break; 168 } 169 line = in.readLine(); 170 } 171 172 QTimer::singleShot(15000, this, SLOT(slotKeepAlive())); 159 173 } 160 174 } -
TabularUnified trunk/BNC/bncnetqueryudp.h ¶
r1756 r1761 23 23 QHostAddress _address; 24 24 int _port; 25 char* _keepAlive; 25 char _keepAlive[12]; 26 int _session; 26 27 }; 27 28 -
TabularUnified trunk/BNC/todo.txt ¶
r1755 r1761 6 6 BNC 7 7 ========================= 8 (1) NTRIP "U": 9 Stopps after ~60sec with message "Data timeout, reconnecting" 10 Could it be that a kind of keep-alife packet is necessary? 11 12 (2) Added "bncnetquerys" for stream input from serial port 8 (1) Added "bncnetquerys" for stream input from serial port 13 9 Please have a look. 14 10 15 ( 3) "Append" files doesn't work with "ZERO" decoder.11 (2) "Append" files doesn't work with "ZERO" decoder. 16 12 17 13 (3) GW: Keep an eye on www.igs-ip.net/PENC0.
Note:
See TracChangeset
for help on using the changeset viewer.