VR-Link API Documentation for HLA 1516
Public Member Functions | Protected Types | Protected Member Functions | Static Protected Member Functions | Protected Attributes | Static Protected Attributes | Private Member Functions

A Socket which starts a thread which is continuously reading and writing from packet queues. More...

+ Inheritance diagram for DtAsyncNetSocket:
+ Collaboration diagram for DtAsyncNetSocket:

List of all members.

Public Member Functions

 DtAsyncNetSocket (int port=DtDEFAULT_PORT, DtU8 flags=DtReadWrite, DtIpv4Addr devAddr=0)
 DtAsyncNetSocket (int port, DtIpv4Addr destAddr, DtU8 flags, DtIpv4Addr devAddr=0)
 DtAsyncNetSocket (char *dummy, int sockfd, DtU8 flags=DtReadWrite)
virtual ~DtAsyncNetSocket ()
 Destructor.
virtual int sendTo (caddr_t packet, size_t size, DtIpv4Addr addr)
 Virtual function override.
virtual int directSendTo (caddr_t packet, size_t size, DtIpv4Addr addr)
 sends the packet directly to the network and bypasses the message queue and sender thread.
virtual bool usingAsyncSend () const
 Get/Set functions to configure AsyncOutput (True by default)
virtual void setUsingAsyncSend (bool b)
virtual bool usingAsyncReceive () const
 Get/Set function for configuring AsyncInput. (True by default)
virtual void setUsingAsyncReceive (bool b)

Protected Types

typedef DtThreadSafe
< std::deque
< DtAsyncSocketPacket > > 
ThreadSafePacketQueue

Protected Member Functions

virtual int recvFromNet (caddr_t *buffptr)
 Virtual Function override, this function instead of reading from the socket, reads from the message queue.
void initThread ()
 Non virtual, called from the constructor.
virtual void workerSendThread ()
 Work function which is the main function in the Send Thread.
virtual void workerReceiveThread ()
 Work function which is the main function in the Receive Thread.
virtual void processSendQueue ()
 Called from the Send thread to process all messages in the list.
virtual void processReceiveQueue ()
 called from the Receive thread to receive ONE packet.

Static Protected Member Functions

static void * runReceive (void *usr_data)
 These functions just call the WorkerSendThread and the WorkerReceiveThread.
static void * runSend (void *usr_data)
static void setQueueTimeout (double new_time_out)
static double queueTimeout ()

Protected Attributes

bool myUseAsyncSendFlag
bool myUseAsyncReceiveFlag
ThreadSafePacketQueue mySendQueue
 A type save queue for sending messages to the network writer.
ThreadSafePacketQueue myReceiveQueue
 A type safe queue for getting messages from the network reader.
volatile bool myTimeToQuitSender
volatile bool myTimeToQuitReceiver
char * myThreadPktBuff
pthread_t mySendThreadHandle
pthread_t myReceiveThreadHandle
int mySendEvent [2]

Static Protected Attributes

static double theQueueTimeout
 The TimeOut in the send Thread, in seconds.

Private Member Functions

 DtAsyncNetSocket (const DtAsyncNetSocket &)
 Copy CTOR Not Implemented.
DtAsyncNetSocketoperator= (const DtAsyncNetSocket &)
 Assignment Operator Not Implemented.

Detailed Description

A Socket which starts a thread which is continuously reading and writing from packet queues.

All messages sent out into the world go onto a Send Queue. Messages read off the network come from a Receive Queue

Deprecated:
This class is replaced by DtInetSocket as of VR-Link 3.13

Member Typedef Documentation


Constructor & Destructor Documentation

DtAsyncNetSocket::DtAsyncNetSocket ( int  port = DtDEFAULT_PORT,
DtU8  flags = DtReadWrite,
DtIpv4Addr  devAddr = 0 
)
DtAsyncNetSocket::DtAsyncNetSocket ( int  port,
DtIpv4Addr  destAddr,
DtU8  flags,
DtIpv4Addr  devAddr = 0 
)
DtAsyncNetSocket::DtAsyncNetSocket ( char *  dummy,
int  sockfd,
DtU8  flags = DtReadWrite 
)
virtual DtAsyncNetSocket::~DtAsyncNetSocket ( ) [virtual]

Destructor.

Copy CTOR Not Implemented.


Member Function Documentation

virtual int DtAsyncNetSocket::directSendTo ( caddr_t  packet,
size_t  size,
DtIpv4Addr  addr 
) [virtual]

sends the packet directly to the network and bypasses the message queue and sender thread.

void DtAsyncNetSocket::initThread ( ) [protected]

Non virtual, called from the constructor.

DtAsyncNetSocket& DtAsyncNetSocket::operator= ( const DtAsyncNetSocket ) [private]

Assignment Operator Not Implemented.

virtual void DtAsyncNetSocket::processReceiveQueue ( ) [protected, virtual]

called from the Receive thread to receive ONE packet.

virtual void DtAsyncNetSocket::processSendQueue ( ) [protected, virtual]

Called from the Send thread to process all messages in the list.

It will not return until the list is empty.

double DtAsyncNetSocket::queueTimeout ( ) [inline, static, protected]
virtual int DtAsyncNetSocket::recvFromNet ( caddr_t *  buffptr) [protected, virtual]

Virtual Function override, this function instead of reading from the socket, reads from the message queue.

Reimplemented from DtNetSocket.

static void* DtAsyncNetSocket::runReceive ( void *  usr_data) [static, protected]

These functions just call the WorkerSendThread and the WorkerReceiveThread.

static void* DtAsyncNetSocket::runSend ( void *  usr_data) [static, protected]
virtual int DtAsyncNetSocket::sendTo ( caddr_t  packet,
size_t  size,
DtIpv4Addr  addr 
) [virtual]

Virtual function override.

DtAsyncNetSocket implements sendTo by placing the packet on the send queue. The worker thread will read it off the queue and send it out to the world using DtNetSocket::sendTo(...). The only difference is that this function queues it first.

Reimplemented from DtNetSocket.

void DtAsyncNetSocket::setQueueTimeout ( double  new_time_out) [inline, static, protected]
void DtAsyncNetSocket::setUsingAsyncReceive ( bool  b) [inline, virtual]
void DtAsyncNetSocket::setUsingAsyncSend ( bool  b) [inline, virtual]
bool DtAsyncNetSocket::usingAsyncReceive ( ) const [inline, virtual]

Get/Set function for configuring AsyncInput. (True by default)

bool DtAsyncNetSocket::usingAsyncSend ( ) const [inline, virtual]

Get/Set functions to configure AsyncOutput (True by default)

virtual void DtAsyncNetSocket::workerReceiveThread ( ) [protected, virtual]

Work function which is the main function in the Receive Thread.

virtual void DtAsyncNetSocket::workerSendThread ( ) [protected, virtual]

Work function which is the main function in the Send Thread.


Member Data Documentation

A type safe queue for getting messages from the network reader.

int DtAsyncNetSocket::mySendEvent[2] [protected]

A type save queue for sending messages to the network writer.

pthread_t DtAsyncNetSocket::mySendThreadHandle [protected]
volatile bool DtAsyncNetSocket::myTimeToQuitReceiver [protected]
volatile bool DtAsyncNetSocket::myTimeToQuitSender [protected]
double DtAsyncNetSocket::theQueueTimeout [static, protected]

The TimeOut in the send Thread, in seconds.


The documentation for this class was generated from the following file:

Document ID: Generated on Mon May 14 08:06:18 EDT 2012 from SVN revision 114750
Copyright © 2005-2012 VT MÄK Inc. All Rights Reserved (www.mak.com)