Skip to content
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions otsdaq/NetworkUtilities/TransceiverSocket.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,10 @@
#include "otsdaq/Macros/CoutMacros.h"
#include "otsdaq/MessageFacility/MessageFacility.h"

#include <chrono>
#include <iostream>
#include <thread> // std::this_thread
#include <mutex>
#include <thread>

using namespace ots;

Expand All @@ -27,7 +29,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<std::mutex> lock(sendMutex_);
Expand Down Expand Up @@ -59,6 +62,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)
Expand Down
6 changes: 4 additions & 2 deletions otsdaq/NetworkUtilities/TransceiverSocket.h
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
6 changes: 6 additions & 0 deletions tools/ots
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Loading