14 #ifndef tcpMsgSocket_H_
15 #define tcpMsgSocket_H_
21 #include <vlutil/vlInetTcpSocket.h>
23 using namespace MAKRti;
28 DtQueuedMsg() : msg(0), size(0), remainingMsg(0), remainingSize(0) {}
30 remainingMsg(m), remainingSize(s) {}
50 size_t recvBufferSize = 20000,
int maxQueuedMsgs = -1);
55 DtBoost::shared_ptr<DtMsgHeaderReader> hdrReader,
56 size_t recvBuffSize = 20000,
int maxQueuedMsgs = -1);
69 virtual void openServerSocket( DtU16 localPort,
70 DtU32 flags = DtDefaultSockOpts, DtInetDevice* hostIf = NULL,
71 DtInetUtils::DtInetAddrFamily family = DtInetUtils::DtInetAddrFamily_IPv4 );
85 virtual void openClientSocket(
const DtInetEndpoint& dest,
86 DtU32 flags = DtDefaultSockOpts, DtU16 localPort = 0,
87 DtInetDevice* hostIf = NULL);
89 virtual DtInetTcpSocket* reconnect();
90 virtual void replaceSocket(std::auto_ptr<DtInetTcpSocket> newSock);
94 virtual int sendMessage(caddr_t msg,
size_t msgSize,
bool deleteAfterSend,
95 const DtInetAddr& destAddr = DtInetAddr::inaddrAny(),
int port = 0);
102 virtual int recvMessage(caddr_t *buffptr);
105 virtual int recvMessageWithSrc(caddr_t *buffptr, DtInetEndpoint& src);
108 virtual void enableBundling(
size_t maxBundleSize);
111 virtual void disableBundling();
114 virtual unsigned bundleSize()
const;
117 virtual void enableCompression(DtU8 compressionLevel);
120 virtual void disableCompression();
123 virtual unsigned compressionLevel()
const;
126 virtual bool testConnectionStatus();
130 virtual void setMaxQueuedMessages(
int size);
134 virtual int maxQueuedMessages()
const;
138 virtual bool getQueueStatus(
int& percentFull)
const;
141 virtual void setTcpNoDelay(
bool enable);
144 virtual void setNonBlocking(
bool nonBlocking);
147 virtual const DtInetEndpoint& destination()
const;
150 virtual DtU32 maxMsgSize()
const;
153 DtInetTcpSocket* inetTcpSocket();
156 bool isConnected()
const {
return mySocket.get() && mySocket->state() == DtInetSockState_CONNECTED; }
161 MAKRti::DtString getErrorString()
const;
163 virtual bool isClient()
const;
168 virtual int sendData(caddr_t msg,
size_t msgSize,
bool deleteAfterSend);
172 virtual bool flushQueue();
175 virtual bool queueMessage(caddr_t msg,
size_t msgSize);
178 virtual void resizeTestPacket();
233 return static_cast<DtInetTcpSocket*
>(mySocket.get());
~DtQueuedMsg()
Definition: tcpMsgSocket.h:31
bool isConnectionInProgress() const
Returns true if the socket is in the process of connecting.
Definition: tcpMsgSocket.h:159
DtU16 myClientLocalPort
Definition: tcpMsgSocket.h:226
size_t myBytesNeededForSize
The number of bytes needed to read the size from the message header.
Definition: tcpMsgSocket.h:219
std::list< DtQueuedMsg > myMsgQueue
The queue of unsent messages.
Definition: tcpMsgSocket.h:196
DtInetBuffer myTestPacket
The buffer to store test packets in.
Definition: tcpMsgSocket.h:193
This file contains the declaration of the DtMsgCompressor class.
DtInetEndpoint myClientDestination
Definition: tcpMsgSocket.h:224
size_t myNumBytesToWaitFor
The number of bytes we are waiting for to complete the message.
Definition: tcpMsgSocket.h:187
DtMsgBundler myMsgBundler
Bundler for outgoing messages.
Definition: tcpMsgSocket.h:199
DtU32 myClientFlags
Definition: tcpMsgSocket.h:225
DtQueuedMsg(caddr_t m, size_t s)
Definition: tcpMsgSocket.h:29
The DtMsgCompressor class provides a means for compressing and uncompressing messages.
Definition: msgCompressor.h:31
bool myNeedSize
Whether we still need to receive the size field for the next/current message.
Definition: tcpMsgSocket.h:184
int myMutableOldQueueLevel
The queue level the last time the user was notified of queue state.
Definition: tcpMsgSocket.h:216
DtInetTcpSocket * inetTcpSocket()
Returns a pointer to the DtInetTcpSocket.
Definition: tcpMsgSocket.h:231
int myMaxQueuedMessages
The maximum size the send queue is allowed to reach.
Definition: tcpMsgSocket.h:211
size_t size
Definition: tcpMsgSocket.h:34
This file contains the declaration of the DtMsgSocket base class.
bool myIsClient
Definition: tcpMsgSocket.h:221
std::auto_ptr< DtInetDevice > myClientHostIf
Definition: tcpMsgSocket.h:227
DtQueuedMsg()
Definition: tcpMsgSocket.h:28
The DtMsgBundler class provides a means for bundling and unbundling messages.
Definition: msgBundler.h:26
The DtTcpMsgSocket class provides an address family independent TCP socket that handles RTI messages...
Definition: tcpMsgSocket.h:42
This file contains the declaration of the DtMsgBundler class.
int myNumBytesReceived
The number of bytes we have so far received for the current message.
Definition: tcpMsgSocket.h:190
bool isConnected() const
Returns true if the socket is connected.
Definition: tcpMsgSocket.h:156
The DtMsgSocket provides a wrapper around the DtInetSocket class to operate on messages rather than j...
Definition: msgSocket.h:29
bool myCompressionEnabled
Whether message compression is enabled.
Definition: tcpMsgSocket.h:208
size_t remainingSize
Definition: tcpMsgSocket.h:36
DtMsgCompressor myMsgCompressor
Message compressor and uncompressor.
Definition: tcpMsgSocket.h:205
Definition: tcpMsgSocket.h:25
caddr_t remainingMsg
Definition: tcpMsgSocket.h:35
#define DT_DLL_RTIUTIL
Definition: rtiMsConfig.h:127
bool myBundlingEnabled
Whether message bundling is enabled.
Definition: tcpMsgSocket.h:202
caddr_t msg
Definition: tcpMsgSocket.h:33