Ignore:
Timestamp:
05/15/04 16:46:27 (20 years ago)
Author:
tbretz
Message:
*** empty log message ***
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/MagicSoft/Cosy/tcpip/MTcpIpIO.cc

    r2517 r4076  
    3333     */
    3434
    35 MTcpIpIO::MTcpIpIO(MLog &out) : MThread(false), Log(out), fRxSocket(NULL), fServSock(NULL)
     35MTcpIpIO::MTcpIpIO(MLog &out)
     36    : MThread(false), Log(out), fRxSocket(NULL), fServSock(NULL), fSendInterval(1000)
    3637{
    3738    fTxSocket = new TSocket("ceco", 7304);
     
    4950    // Now delete all TCP/IP objects
    5051    //
    51     cout << "Delete TxSocket " << fTxSocket << "..." << flush;
     52    //cout << "Delete TxSocket " << fTxSocket << "..." << flush;
    5253    delete fTxSocket;
    53     cout << "Done." << endl;
     54    //cout << "Done." << endl;
    5455    if (fServSock)
    5556    {
    56         cout << "Delete ServSock " << fServSock << "..." << flush;
     57        //cout << "Delete ServSock " << fServSock << "..." << flush;
    5758        delete fServSock;
    58         cout << "Done." << endl;
     59        //cout << "Done." << endl;
    5960    }
    6061    if (fRxSocket)
    6162    {
    62         cout << "Delete RxSocket " << fRxSocket << "..." << flush;
     63        //cout << "Delete RxSocket " << fRxSocket << "..." << flush;
    6364        delete fRxSocket;
    64         cout << "Done." << endl;
     65        //cout << "Done." << endl;
    6566    }
    6667}
     
    6869bool MTcpIpIO::Send(const char *msg)
    6970{
     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
    7086    if (!fTxSocket->IsValid())
    7187        return false;
     
    112128            switch (fServSock->GetErrorCode())
    113129            {
    114             case 0: cout << "No error." << endl; break;
     130            case  0: cout << "No error." << endl; break;
    115131            case -1: cout << "low level socket() call failed." << endl; break;
    116132            case -2: cout << "low level bind() call failed." << endl; break;
Note: See TracChangeset for help on using the changeset viewer.