Ignore:
Timestamp:
04/22/09 10:46:59 (15 years ago)
Author:
tbretz
Message:
*** empty log message ***
File:
1 edited

Legend:

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

    r8869 r9432  
    1515
    1616#undef DEBUG
     17//#define DEBUG
    1718
    1819using namespace std;
     
    4041     */
    4142
    42 MTcpIpO::MTcpIpO(const char *addr, Int_t tx)
    43 {
     43MTcpIpO::MTcpIpO(const char *addr, Int_t tx) : fPortTx(tx)
     44{
     45    gLog << inf2 << "- Open send socket to " << addr << ":" << tx << endl;
    4446    fTxSocket = new TSocket(addr, tx);
    4547}
     
    147149bool MTcpIpO::Send(const char *msg, Int_t len)
    148150{
     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
    149163    return SendFrame(*fTxSocket, msg, len);
    150164}
     
    206220    fConnectionEstablished = kTRUE;
    207221
    208     MTimeout timeout;
     222    MTimeout timeout(fTimeout);
    209223
    210224    // Get connection on port fPortRx and redirected
     
    228242            if (timeout.HasTimedOut())
    229243            {
    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;
    231245                return kFALSE;
    232246            }
     
    285299            fConnectionEstablished = kFALSE;
    286300
     301#ifdef DEBUG
     302        cout << "===> DEL SOCKET" << endl;
     303#endif
    287304        delete socket;
    288305    }
     
    314331        }
    315332
     333#ifdef DEBUG
     334        cout << "===> DEL SERVER" << endl;
     335#endif
    316336        delete server;
    317337
Note: See TracChangeset for help on using the changeset viewer.