Changeset 4076 for trunk/MagicSoft/Cosy/tcpip/MTcpIpIO.cc
- Timestamp:
- 05/15/04 16:46:27 (20 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Cosy/tcpip/MTcpIpIO.cc
r2517 r4076 33 33 */ 34 34 35 MTcpIpIO::MTcpIpIO(MLog &out) : MThread(false), Log(out), fRxSocket(NULL), fServSock(NULL) 35 MTcpIpIO::MTcpIpIO(MLog &out) 36 : MThread(false), Log(out), fRxSocket(NULL), fServSock(NULL), fSendInterval(1000) 36 37 { 37 38 fTxSocket = new TSocket("ceco", 7304); … … 49 50 // Now delete all TCP/IP objects 50 51 // 51 cout << "Delete TxSocket " << fTxSocket << "..." << flush;52 //cout << "Delete TxSocket " << fTxSocket << "..." << flush; 52 53 delete fTxSocket; 53 cout << "Done." << endl;54 //cout << "Done." << endl; 54 55 if (fServSock) 55 56 { 56 cout << "Delete ServSock " << fServSock << "..." << flush;57 //cout << "Delete ServSock " << fServSock << "..." << flush; 57 58 delete fServSock; 58 cout << "Done." << endl;59 //cout << "Done." << endl; 59 60 } 60 61 if (fRxSocket) 61 62 { 62 cout << "Delete RxSocket " << fRxSocket << "..." << flush;63 //cout << "Delete RxSocket " << fRxSocket << "..." << flush; 63 64 delete fRxSocket; 64 cout << "Done." << endl;65 //cout << "Done." << endl; 65 66 } 66 67 } … … 68 69 bool MTcpIpIO::Send(const char *msg) 69 70 { 71 const MTime t(-1); 72 73 if ((double)t-(double)fTime<0.001*fSendInterval) 74 return true; 75 76 const Int_t rc = lout.IsOutputDeviceEnabled(MLog::eGui); 77 lout.DisableOutputDevice(MLog::eGui); 78 lout.Lock(); 79 lout << msg << flush; 80 lout.UnLock(); 81 if (rc) 82 lout.EnableOutputDevice(MLog::eGui); 83 84 fTime = t; 85 70 86 if (!fTxSocket->IsValid()) 71 87 return false; … … 112 128 switch (fServSock->GetErrorCode()) 113 129 { 114 case 0: cout << "No error." << endl; break;130 case 0: cout << "No error." << endl; break; 115 131 case -1: cout << "low level socket() call failed." << endl; break; 116 132 case -2: cout << "low level bind() call failed." << endl; break;
Note:
See TracChangeset
for help on using the changeset viewer.