TcpLib
Loading...
Searching...
No Matches
TcpClientReceiver.h
Go to the documentation of this file.
1#ifndef INC_TCPCLIENTRECEIVER_H
2#define INC_TCPCLIENTRECEIVER_H
3//-----------------------------------------------------------------------------
43//-----------------------------------------------------------------------------
44#include "TcpTypes.h"
45#include "TcpDataReceiver.h"
46
47#include "TcpMain.h"
48
49#if defined(_MSC_VER) || defined(__MINGW32__) || defined(__MINGW64__)
50 #include <winsock.h>
51#endif
52//-----------------------------------------------------------------------------
53namespace tcp
54{
55 //---------------------------------------------------------------------------
56 //Forwards
57 class AbstractMessage;
58 class Client;
59 //---------------------------------------------------------------------------
81 {
82 private:
83 //============== Attribute
84 //-----------------------------------------------------------------------
95 //-----------------------------------------------------------------------
96
97 protected:
98 //============== Konstruktoren
99 //-----------------------------------------------------------------------
110 //-----------------------------------------------------------------------
120 ClientReceiver( SOCKET );
121 //-----------------------------------------------------------------------
132 //-----------------------------------------------------------------------
142 ClientReceiver( TcpMain *, SOCKET, unsigned int );
143 //-----------------------------------------------------------------------
144
145 public:
146 //============== Konstruktoren
147 //-----------------------------------------------------------------------
165 ClientReceiver( Client * pParent, SOCKET Socket, unsigned int uiDataSize );
166 //-----------------------------------------------------------------------
177 //-----------------------------------------------------------------------
178
179 private:
180 //============== Copy-Konstruktor
181 //-----------------------------------------------------------------------
192 //-----------------------------------------------------------------------
193
194 protected:
195 //============== Methoden
196 //-----------------------------------------------------------------------
211 virtual void work() override;
212 //-----------------------------------------------------------------------
213 #if defined (__PTHREADS)
214 /*
215 \if english
216 When the thread ends, this virtual method is called.
217 \note This method only exists when compiled with POSIX threads (defined
218 (__PTHREADS)).
219 \endif
220
221 \if german
222 Wenn der Thread beendet wirde, wird diese virtuale Methode aufgerufen.
223 \note Diese Methode gibt es nur, wenn mit POSIX-Threads kompiliert
224 (defined (__PTHREADS)).
225 \endif
226 */
227 virtual void cleanUp();
228 #endif
229 //-----------------------------------------------------------------------
256 virtual int acceptMessage( AbstractMessage * pTcpMessage ) override;
257 //-----------------------------------------------------------------------
287 virtual void generateNewTcpMessage( AbstractMessage *& prTcpMessage,
288 char * pszTransmitData,
289 unsigned int uiTransmitDataSize ) const override;
290 //-----------------------------------------------------------------------
322 virtual void generateNewTcpMessage( AbstractMessage *& prTcpMessage,
323 char * pszRawMsg,
324 unsigned int uiRawMsgSize,
325 unsigned int uiMessageID,
326 int iActionCode,
327 const std::string & rstrInfo ) const override;
328 //-----------------------------------------------------------------------
329
330 public:
331 //========== Methoden ========
332 //-----------------------------------------------------------------------
342 #if defined (__PTHREADS)
343 virtual int cancel();
344 #else
345 virtual void cancel() override;
346 #endif
347 //-----------------------------------------------------------------------
359 bool connected() const;
360 //-------------------------------------------------------------------------
361
362 private:
363 //============== Operatoren
364 //-----------------------------------------------------------------------
374 ClientReceiver & operator= ( const ClientReceiver & );
375 //-----------------------------------------------------------------------
376 };
377 //---------------------------------------------------------------------------
378} // namespace tcp
379//-----------------------------------------------------------------------------
380#endif
Header for DataReceiver.
Header for TcpMain
For each library, here 'TcpLib' there is a type file.
#define __tcp_export_dll
Definition TcpTypes.h:59
Base class for messages which can be sent, received and processed by the Tcp-classes.
Definition TcpMessage.h:97
A simple TCP client class, which should learn its know-how in the derived classes.
Definition TcpClient.h:199
Class that communicates with a Server via a SOCKET and delivers its receive result of type Message to...
Definition TcpClientReceiver.h:81
bool connected() const
ClientReceiver(const ClientReceiver &)
ClientReceiver(TcpMain *, SOCKET)
virtual void work() override
virtual void cancel() override
bool m_bHaveConnection
Definition TcpClientReceiver.h:94
virtual int acceptMessage(AbstractMessage *pTcpMessage) override
ClientReceiver(TcpMain *, SOCKET, unsigned int)
virtual ~ClientReceiver()
virtual void generateNewTcpMessage(AbstractMessage *&prTcpMessage, char *pszTransmitData, unsigned int uiTransmitDataSize) const override
ClientReceiver(Client *pParent, SOCKET Socket, unsigned int uiDataSize)
virtual void generateNewTcpMessage(AbstractMessage *&prTcpMessage, char *pszRawMsg, unsigned int uiRawMsgSize, unsigned int uiMessageID, int iActionCode, const std::string &rstrInfo) const override
Superclass for all TcpReceiver that communicate via a SOCKET and deliver their receive result,...
Definition TcpDataReceiver.h:85
Superclass for Client and Server, which 'learns' its know-how in the derived classes.
Definition TcpMain.h:110
Definition TcpClient.h:55