diff --git a/otsdaq/NetworkUtilities/TransceiverSocket.cc b/otsdaq/NetworkUtilities/TransceiverSocket.cc index c894acf3..607d2720 100644 --- a/otsdaq/NetworkUtilities/TransceiverSocket.cc +++ b/otsdaq/NetworkUtilities/TransceiverSocket.cc @@ -2,8 +2,11 @@ #include "otsdaq/Macros/CoutMacros.h" #include "otsdaq/MessageFacility/MessageFacility.h" +#include +#include #include -#include // std::this_thread +#include +#include using namespace ots; @@ -27,7 +30,8 @@ TransceiverSocket::~TransceiverSocket(void) {} /// returns 0 on success int TransceiverSocket::acknowledge(const std::string& buffer, bool verbose /* = false */, - size_t maxChunkSize /* = 1500 */) + size_t maxChunkSize /* = 1500 */, + unsigned int interPacketGapUSeconds /* = 0 */) { // lockout other senders for the remainder of the scope std::lock_guard lock(sendMutex_); @@ -59,6 +63,8 @@ int TransceiverSocket::acknowledge(const std::string& buffer, (struct sockaddr*)&(ReceiverSocket::fromAddress_), sizeof(sockaddr_in)); offset += sendToSize / sizeInBytes; + if(interPacketGapUSeconds > 0 && offset < buffer.size() && sendToSize > 0) + usleep(interPacketGapUSeconds); } if(sendToSize <= 0) diff --git a/otsdaq/NetworkUtilities/TransceiverSocket.h b/otsdaq/NetworkUtilities/TransceiverSocket.h index 6b06f22f..2888a5c7 100644 --- a/otsdaq/NetworkUtilities/TransceiverSocket.h +++ b/otsdaq/NetworkUtilities/TransceiverSocket.h @@ -14,9 +14,11 @@ class TransceiverSocket : public TransmitterSocket, public ReceiverSocket TransceiverSocket(std::string IPAddress, unsigned int port = 0); virtual ~TransceiverSocket(void); + /// acknowledge() responds to last receive location int acknowledge(const std::string& buffer, - bool verbose = false, - size_t maxChunkSize = 1500); ///< responds to last receive location + bool verbose = false, + size_t maxChunkSize = 1500, + unsigned int interPacketGapUSeconds = 0); std::string sendAndReceive(Socket& toSocket, const std::string& sendBuffer, diff --git a/tools/ots b/tools/ots index 027f2118..45d8fd61 100644 --- a/tools/ots +++ b/tools/ots @@ -916,6 +916,12 @@ launchOTSMacromaker() { out "${Blue}${REV} ${RstClr}${Reset}" #Reset needed to prevent highlight of text in reverse searches after this output out #blank line + if [ "x$OTS_MACROMAKER_UDP_IP" == "x" ] || [ "x$OTS_MACROMAKER_UDP_PORT" == "x" ]; then + warning "If you would like to enable command-line access to your MacroMaker mode instance, then before launching please set an IP/PORT compatible with the the system's networking interfaces using environment variables OTS_MACROMAKER_UDP_IP and OTS_MACROMAKER_UDP_PORT" + out #blank line + fi + + unset ContextPIDArray #reset unset ContextPIDNameArray #reset unset ContextPIDIsAliveArray #reset