KrisLibrary  1.0.0
Public Member Functions | List of all members
SocketPipeWorker Class Reference

Launches a thread for asynchronous bidirectional communication with a socket. More...

#include <AsyncIO.h>

Inheritance diagram for SocketPipeWorker:
AsyncPipeThread AsyncPipeQueue

Public Member Functions

 SocketPipeWorker (const char *addr, bool asServer=false, double timeout=Math::Inf)
 
 SocketPipeWorker (const char *addr, SOCKET socket, double timeout=Math::Inf)
 
- Public Member Functions inherited from AsyncPipeThread
 AsyncPipeThread (double timeout=Math::Inf)
 
virtual void Reset ()
 
virtual void Work ()
 
virtual bool Start ()
 Subclasses: override these to implement custom starting and stopping routines.
 
virtual void Stop ()
 
bool Connected ()
 
bool WriteReady ()
 
bool ReadReady ()
 
- Public Member Functions inherited from AsyncPipeQueue
 AsyncPipeQueue (size_t recvQueueSize=1000, size_t writeQueueSize=1000)
 
void OnRead (const std::string &msg)
 
void OnRead_NoLock (const std::string &msg)
 
bool WriteAvailable () const
 Called by subclass to see whether there's a message to send.
 
std::string OnWrite ()
 Called by subclass to get the next message to send to the destination.
 
std::string OnWrite_NoLock ()
 
int MessageCount ()
 Receive functions.
 
int UnreadCount ()
 
std::string PeekNewest ()
 
std::vector< std::string > New ()
 
std::string Newest ()
 
void Send (const std::string &msg)
 Send functions.
 
int SentCount ()
 
int DeliveredCount ()
 

Additional Inherited Members

- Public Attributes inherited from AsyncPipeThread
std::unique_ptr< TransportBasetransport
 
bool initialized
 
Thread workerThread
 
double timeout
 
Timer timer
 
Mutex mutex
 
double lastReadTime
 
double lastWriteTime
 
- Public Attributes inherited from AsyncPipeQueue
AsyncReaderQueue reader
 
AsyncWriterQueue writer
 

Detailed Description

Launches a thread for asynchronous bidirectional communication with a socket.

Calling thread can safely use the AsyncPipeQueue methods e.g., SendMessage, NewMessageCount, NewMessage, NewestMessage while the thread is running.


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