8 #ifndef vlAsyncSocket_H_
9 #define vlAsyncSocket_H_
26 #ifdef DtUSE_UTILITIES_NAMESPACE
27 namespace DtUSE_UTILITIES_NAMESPACE
47 size_t size()
const {
return mySize;}
48 char *
data() {
return &myData[0];}
96 virtual int sendTo(caddr_t packet,
size_t size,
DtIpv4Addr addr);
100 virtual int directSendTo(caddr_t packet,
size_t size,
DtIpv4Addr addr);
103 virtual bool usingAsyncSend()
const;
104 virtual void setUsingAsyncSend(
bool b);
107 virtual bool usingAsyncReceive()
const;
108 virtual void setUsingAsyncReceive(
bool b);
114 virtual int recvFromNet(caddr_t *buffptr);
120 virtual void workerSendThread();
123 virtual void workerReceiveThread();
127 virtual void processSendQueue();
130 virtual void processReceiveQueue();
136 static unsigned long runReceive(
void* usr_data);
137 static unsigned long runSend(
void *user_data);
139 static void* runReceive(
void* usr_data);
140 static void* runSend(
void* usr_data);
142 static void setQueueTimeout(
double new_time_out);
143 static double queueTimeout();
169 HANDLE mySendThreadHandle;
170 HANDLE myReceiveThreadHandle;
172 HANDLE myReceiveEvent;
184 theQueueTimeout = time_out;
190 return theQueueTimeout;
195 return myUseAsyncSendFlag;
201 myUseAsyncSendFlag = b;
206 return myUseAsyncReceiveFlag;
212 myUseAsyncReceiveFlag = b;
215 #ifdef DtUSE_UTILITIES_NAMESPACE
bool myUseAsyncSendFlag
Definition: vlAsyncSocket.h:155
DtU32 DtIpv4Addr
Definition: vlUtil.h:245
This file contains the declaration of DtMutex.
A Socket which starts a thread which is continuously reading and writing from packet queues...
Definition: vlAsyncSocket.h:65
DtIpv4Addr addr() const
Definition: vlAsyncSocket.h:49
static void setQueueTimeout(double new_time_out)
Definition: vlAsyncSocket.h:182
bool myUseAsyncReceiveFlag
Definition: vlAsyncSocket.h:156
ThreadSafePacketQueue myReceiveQueue
A type safe queue for getting messages from the network reader.
Definition: vlAsyncSocket.h:162
#define DtDEFAULT_PORT
Definition: vlSocket.h:49
int mySize
Definition: vlAsyncSocket.h:53
virtual bool usingAsyncReceive() const
Get/Set function for configuring AsyncInput. (True by default)
Definition: vlAsyncSocket.h:204
size_t size() const
Definition: vlAsyncSocket.h:47
pthread_t myReceiveThreadHandle
Definition: vlAsyncSocket.h:175
Contains declaration of DtRunnable abstract class.
virtual void setUsingAsyncSend(bool b)
Definition: vlAsyncSocket.h:199
unsigned char DtU8
An eight bit unsigned integer value.
Definition: vlMachineTypes.h:137
static double queueTimeout()
Definition: vlAsyncSocket.h:188
Encapsulates a packet which is to be either received or transmitted over the network by the DtAsyncSo...
Definition: vlAsyncSocket.h:36
volatile bool myTimeToQuitReceiver
Definition: vlAsyncSocket.h:165
DtIpv4Addr myAddr
Definition: vlAsyncSocket.h:55
pthread_t mySendThreadHandle
Definition: vlAsyncSocket.h:174
DtThreadSafe< std::deque< DtAsyncSocketPacket > > ThreadSafePacketQueue
Definition: vlAsyncSocket.h:153
#define DtReadWrite
Marks the Socket as Read and Writable.
Definition: vlInetSocket.h:37
volatile bool myTimeToQuitSender
Definition: vlAsyncSocket.h:164
std::vector< char > myData
Definition: vlAsyncSocket.h:54
#define DT_DLL_NETCOMPAT
Definition: vlMachineTypes.h:111
static double theQueueTimeout
The TimeOut in the send Thread, in seconds.
Definition: vlAsyncSocket.h:148
This file declares DtNetSocket, as well as several enumerations and constants needed for its use...
ThreadSafePacketQueue mySendQueue
A type save queue for sending messages to the network writer.
Definition: vlAsyncSocket.h:159
a thread safe interface to a value.
Definition: vlThreadSafe.h:104
Defines a ThreadedObject which can run a DtRunnable object in a thread.
Defines a thread-safe template class for variables.
char * data()
Definition: vlAsyncSocket.h:48
virtual bool usingAsyncSend() const
Get/Set functions to configure AsyncOutput (True by default)
Definition: vlAsyncSocket.h:193
A DtSocket that implements network sending and receiving function using IP/UDP broadcast, multicast or unicast.
Definition: vlNetSocket.h:72
virtual void setUsingAsyncReceive(bool b)
Definition: vlAsyncSocket.h:210
char * myThreadPktBuff
Definition: vlAsyncSocket.h:166