Public Member Functions |
| | DtUdpMsgSocket (DtBoost::shared_ptr< DtMsgHeaderReader > hdrReader, size_t maxPacketSize=DtDefaultMaxPacketSize) |
| | Constructor.
|
| virtual | ~DtUdpMsgSocket () |
| | Destructor.
|
| virtual void | openSocket (const DtInetEndpoint &dest, DtU32 flags=DtDefaultSockOpts, DtU16 localPort=0, DtInetDevice *hostIf=NULL) |
| | Opens the socket if not already open.
|
| virtual int | sendMessage (caddr_t msg, size_t msgSize, bool deleteAfterSend, const DtInetAddr &destAddr=DtInetAddr::inaddrAny()) |
| | Sends a message.
|
| virtual bool | flush () |
| | Attempts to send any queued messages and bundled messages.
|
| virtual int | recvMessage (caddr_t *buffptr) |
| | Gets the next message from the incoming data.
|
| virtual int | recvMessageWithSrc (caddr_t *buffptr, DtInetEndpoint &src) |
| | Gets the next message from the incoming data.
|
| virtual void | enableBundling (size_t maxBundleSize) |
| | Enables message bundling and sets the maximum bundle size.
|
| virtual void | disableBundling () |
| | Disables message bundling.
|
| virtual void | enableCompression (DtU8 compressionLevel) |
| | Enables message compression and sets the compression level.
|
| virtual void | disableCompression () |
| | Disables message compression.
|
| virtual bool | joinMulticastGroup (const DtInetAddr &grpAddr, DtInetDevice *device=NULL) |
| | Join / drop subscription to multicast group.
|
| virtual bool | joinMulticastGroup (const DtInetEndpoint &grpEndpoint, DtInetDevice *device=NULL) |
| virtual bool | dropMulticastGroup (const DtInetAddr &grpAddr, DtInetDevice *device=NULL) |
| virtual bool | dropMulticastGroup (const DtInetEndpoint &grpEndpoint, DtInetDevice *device=NULL) |
| virtual bool | setMcastTtlOption (DtU32 ttl) |
| | Change the default time-to-live on outbound multicast packets sent from this socket.
|
| virtual void | setRetryOnSend (unsigned int numRetries, double waitPeriod) |
| | Enables/disables send retries on failure.
|
| virtual DtU32 | maxMsgSize () const |
| | Gets the maximum message size.
|
| virtual bool | isOpen () const |
| | Returns true if the socket is open.
|
| DtInetUdpSocket * | inetUdpSocket () |
| | Returns a pointer to the DtInetUdpSocket.
|
| void | setFilterPort (int port) |
| | Sets the filter port.
|
| | DtMsgSocket (DtBoost::shared_ptr< DtMsgHeaderReader > hdrReader, size_t recvBuffSize) |
| | Constructor.
|
| | DtMsgSocket (std::auto_ptr< DtInetSocket > socket, DtBoost::shared_ptr< DtMsgHeaderReader > hdrReader, size_t recvBuffSize) |
| | Constructor which takes a pre-created DtInetSocket pointer.
|
| virtual | ~DtMsgSocket () |
| | Destructor.
|
| virtual bool | closeSocket () |
| | Close a socket. Returns true on successful close or false on failure.
|
| virtual DtInetSockState | state () const |
| | Returns the state of the socket.
|
| void | printStateToStream (MAKRti::DtOutputStream &stream) const |
| | prints state to stream
|
| const DtString & | lastError () const |
| | Returns a description of the last error.
|
| const DtInetEndpoint & | localEndpoint () const |
| | Gets the local endpoint for the socket.
|
| void | setSendBufferSize (DtU32 size) |
| | Sets the socket send buffer size.
|
| void | setRecvBufferSize (DtU32 size) |
| | Sets the socket receive buffer size.
|
| DtU32 | maxSendMsgSize () const |
| | Gets the maximum socket send size.
|
| unsigned int | descriptor () const |
| | Get's the socket file descriptor.
|
| DtInetSocket * | inetSocket () |
| | Returns a pointer to the DtInetSocket.
|
Protected Member Functions |
| virtual int | sendPacket (caddr_t msg, size_t msgSize, const DtInetAddr &destAddr=DtInetAddr::inaddrAny()) |
| | Sends a single packet.
|
| virtual int | retrySendTo (caddr_t msg, size_t msgSize, const DtInetAddr &destAddr=DtInetAddr::inaddrAny()) |
| | Retries sending a message which failed to send.
|
| virtual int | recv (caddr_t *buffptr, DtInetEndpoint *ep) |
| | Gets the next message from the incoming data.
|
| void | expandRecvBuffer (size_t sizeNeeded) |
| | Expands the receive buffer to accommodate the given size message.
|
The DtUdpMsgSocket class provides an address family independent UDP socket that handles RTI messages.
| virtual void DtUdpMsgSocket::openSocket |
( |
const DtInetEndpoint & |
dest, |
|
|
DtU32 |
flags = DtDefaultSockOpts, |
|
|
DtU16 |
localPort = 0, |
|
|
DtInetDevice * |
hostIf = NULL |
|
) |
| |
|
virtual |
Opens the socket if not already open.
Takes a DtInetEndpoint (containing the destination address, protocol - TCP or UDP, and destination port number), a source port number to use, a pointer to the local network interface device the socket will be bound to, and socket option flags. The address family (IPv4 or IPv6) is assumed from the dest endpoint object. If the specified local port is 0 an ephemeral port will be chosen for the connection UNLESS the destination is a broadcast or multicast address, in which case the destination port is used as the local port also. If no host interface is specified the most appropriate interface will be chosen based on the destination. If the destination endpoint specifies a multicast address the multicast group is joined automatically when the socket is opened and the group member- ship is dropped when the socket is closed. This ctor will not throw exceptions on failure. Check the socket status by calling state() to determine if the socket is ready.
Reimplemented in DtSmSocket__rti__.