swiftdicomdcmtk

How to change the default network socket timeout in DCMTK?


The default network socket timeout in DCMTK is 60 seconds.

How to change it to 30?

I could see the code written as below, but could not change it to 30:

extern DCMTK_DCMNET_EXPORT OFGlobal<Sint32> dcmSocketReceiveTimeout;   /* default: 60 */

Solution

  • As far as I understand your question, you want to set the timeout programmtically.
    You can check how to do this in the dcmtk tools like echoscu -- basically you have to call:

    #include "dcmtk/dcmnet/dcmtrans.h"
    
    dcmSocketReceiveTimeout.set(OFstatic_cast(Sint32, new_socket_timeout));
    

    and the global timeout will change accordingly.
    The same is true for setting the send timeout, where you use dcmSocketSendTimeout instead.