Changeset 9432 for trunk/MagicSoft/Cosy/tcpip
- Timestamp:
- 04/22/09 10:46:59 (16 years ago)
- Location:
- trunk/MagicSoft/Cosy/tcpip
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Cosy/tcpip/MCeCoCom.cc
r8998 r9432 133 133 134 134 const TString msg = 135 MString::Format("%s "135 MString::Format("%s M%d " 136 136 "%02d %04d %02d %02d %02d %02d %02d %03d " 137 137 "%02d %04d %02d %02d %02d %02d %02d %03d " 138 "%s\n", cmd, 138 "%s\n", cmd, fTelescope, 139 139 fStatus, y1, mon1, d1, h1, m1, s1, ms1, 140 140 fComStat, y2, mon2, d2, h2, m2, s2, ms2, -
trunk/MagicSoft/Cosy/tcpip/MCeCoCom.h
r8869 r9432 33 33 int fCCStatus; // global status of CC 34 34 35 Byte_t fTelescope; 36 35 37 ComStatus_t fComStat; // communication status 36 38 … … 49 51 public: 50 52 MCeCoCom(const char *addr, const int tx=7304, const int rx=7404, MLog *out=NULL) 51 : MTcpIpIO(addr, tx, rx), fOut(out), fStatus(0), fComStat(kNoCmdReceived), 53 : MTcpIpIO(addr, tx, rx), fOut(out), fStatus(0), 54 fTelescope(1), fComStat(kNoCmdReceived), 52 55 fHumidity(0), fTemperature(0), fWindSpeed(0), fSolarRadiation(-1), 53 56 fAlarmCounter(0) … … 60 63 bool SendRep(const char *cmd, const char *str, bool force); 61 64 void SetStatus(Byte_t s) { fStatus=s; } 65 66 void SetTelescope(Byte_t tel) { fTelescope = tel; } 62 67 63 68 Float_t GetHumidity() const { return fHumidity; } -
trunk/MagicSoft/Cosy/tcpip/MTcpIpIO.cc
r8869 r9432 15 15 16 16 #undef DEBUG 17 //#define DEBUG 17 18 18 19 using namespace std; … … 40 41 */ 41 42 42 MTcpIpO::MTcpIpO(const char *addr, Int_t tx) 43 { 43 MTcpIpO::MTcpIpO(const char *addr, Int_t tx) : fPortTx(tx) 44 { 45 gLog << inf2 << "- Open send socket to " << addr << ":" << tx << endl; 44 46 fTxSocket = new TSocket(addr, tx); 45 47 } … … 147 149 bool MTcpIpO::Send(const char *msg, Int_t len) 148 150 { 151 if (!fTxSocket->IsValid()) 152 { 153 const TInetAddress &a = fTxSocket->GetInetAddress(); 154 if (!a.IsValid()) 155 return false; 156 #ifdef DEBUG 157 cout << "- Reopen send socket to " << a.GetHostAddress() << ":" << fPortTx << endl; 158 #endif 159 delete fTxSocket; 160 fTxSocket = new TSocket(a.GetHostAddress(), fPortTx); 161 } 162 149 163 return SendFrame(*fTxSocket, msg, len); 150 164 } … … 206 220 fConnectionEstablished = kTRUE; 207 221 208 MTimeout timeout ;222 MTimeout timeout(fTimeout); 209 223 210 224 // Get connection on port fPortRx and redirected … … 228 242 if (timeout.HasTimedOut()) 229 243 { 230 gLog << warn << MTime(-1) << " WARNING - Connection to " << MTcpIpO::GetSocketAddress(sock) << " timed out ." << endl;244 gLog << warn << MTime(-1) << " WARNING - Connection to " << MTcpIpO::GetSocketAddress(sock) << " timed out after " << fTimeout << "ms." << endl; 231 245 return kFALSE; 232 246 } … … 285 299 fConnectionEstablished = kFALSE; 286 300 301 #ifdef DEBUG 302 cout << "===> DEL SOCKET" << endl; 303 #endif 287 304 delete socket; 288 305 } … … 314 331 } 315 332 333 #ifdef DEBUG 334 cout << "===> DEL SERVER" << endl; 335 #endif 316 336 delete server; 317 337 -
trunk/MagicSoft/Cosy/tcpip/MTcpIpIO.h
r8865 r9432 44 44 TSocket *fTxSocket; 45 45 46 Int_t fPortTx; 47 46 48 public: 47 49 MTcpIpO(const char *addr, Int_t tx);
Note:
See TracChangeset
for help on using the changeset viewer.