GlobalObjects
Lade ...
Suche ...
Keine Treffer
TcpMain.h
gehe zur Dokumentation dieser Datei
1#ifndef INC_TCPMAIN_H
2#define INC_TCPMAIN_H
3//-----------------------------------------------------------------------------
43//-----------------------------------------------------------------------------
44#include "TcpTypes.h"
45#include "TcpSocketTypes.h"
46
47#if defined (__PTHREADS)
48 #include "EuEndlessPThread.h"
49 #include <semaphore.h>
50#else
51 #include "EuRepeatingThread.h"
52#endif
53//-----------------------------------------------------------------------------
54namespace tcp
55{
56 //---------------------------------------------------------------------------
57 // Forwards
58 class Message;
59 //---------------------------------------------------------------------------
60 #ifdef _MSC_VER
61 /* 'Bezeichner': Klasse 'Typ' benötigt eine DLL-Schnittstelle, die von... */
62 #pragma warning( disable : 4251 )
63 /* class 'TYP' ist keine DLL-Schnittstelle und wurde als Basisklasse... */
64 #pragma warning( disable : 4275 )
65 #endif
66 //---------------------------------------------------------------------------
82 #if defined (__PTHREADS)
83 class __tcp_export_dll TcpMain : public EuEndlessPThread
84 #else
86 #endif
87 {
88 private:
89 //============== static-attributes
90 //-----------------------------------------------------------------------
104 static unsigned int m_uiTcpMainCounter;
105 //-----------------------------------------------------------------------
106
107 protected:
108 //============== attributes
109 //-----------------------------------------------------------------------
121 //-----------------------------------------------------------------------
133 unsigned int m_uiServerPort;
134 //-----------------------------------------------------------------------
146 unsigned int m_uiDataSize;
147 //-----------------------------------------------------------------------
158 //-----------------------------------------------------------------------
169 //-----------------------------------------------------------------------
180 //-----------------------------------------------------------------------
191 //-----------------------------------------------------------------------
192
193 //============== ctor
194 //-----------------------------------------------------------------------
205 //-----------------------------------------------------------------------
206
207 public:
208 //============== ctors
209 //-----------------------------------------------------------------------
241 TcpMain( unsigned int uiPort,
242 int iAdressFamily,
243 int iSocketType,
244 int iProtocol,
245 int iSecTimeOut );
246 //-----------------------------------------------------------------------
280 TcpMain( unsigned int uiPort,
281 int iAdressFamily,
282 int iSocketType,
283 int iProtocol,
284 unsigned int uiDataSize,
285 int iSecTimeOut );
286 //-----------------------------------------------------------------------
296 virtual ~TcpMain();
297 //-----------------------------------------------------------------------
298
299 private:
300 //============== copy-ctor
301 //-----------------------------------------------------------------------
311 TcpMain( const TcpMain & );
312 //-----------------------------------------------------------------------
313
314 public:
315 //============== methods
316 //-----------------------------------------------------------------------
326 unsigned int getPortNum() const;
327 //-----------------------------------------------------------------------
341 virtual void setDataSize( unsigned int uiDataSize );
342 //-----------------------------------------------------------------------
352 unsigned int getDataSize() const;
353 //-----------------------------------------------------------------------
363 SOCKET getMainSocket() const;
364 //-----------------------------------------------------------------------
390 virtual int send( Message * pTcpMessage ) = 0;
391 //-----------------------------------------------------------------------
403 void setTimeOutSec( int iSecTimeOut );
404 //-----------------------------------------------------------------------
417 //-----------------------------------------------------------------------
418
419 protected:
420 //============== methods
421 //-----------------------------------------------------------------------
433 void setWSACleanup() const;
434 //-----------------------------------------------------------------------
446 int startWinsock() const;
447 //-----------------------------------------------------------------------
448
449 private:
450 //============== operators
451 //-----------------------------------------------------------------------
461 TcpMain & operator= ( const TcpMain & );
462 //-----------------------------------------------------------------------
463 };
464 //---------------------------------------------------------------------------
465 #ifdef _MSC_VER
466 /* 'Bezeichner': Klasse 'Typ' benötigt eine DLL-Schnittstelle, die von... */
467 #pragma warning( default : 4251 )
468 /* class 'TYP' ist keine DLL-Schnittstelle und wurde als Basisklasse... */
469 #pragma warning( default : 4275 )
470 #endif
471 //---------------------------------------------------------------------------
472} // namespace tcp
473//-----------------------------------------------------------------------------
474#endif
Header für EuEndlessPThread
Header für RepeatingThread
Bindet die Socket-Bibliothek/en ein und definiert Socket-Typen.
Für jede Bibliothek, hier 'TcpLib' gibt es eine Typen-Datei.
#define __tcp_export_dll
Definition TcpTypes.h:59
Basisklasse für einen Thread der seine Arbeit endlos bis zum Abbruch ausführt.
Definition EuRepeatingThread.h:94
Beinhaltet einen Datenstrom, welcher von den Tcp-Klassen versendet und empfangen werden kann.
Definition TcpMessage.h:147
Oberklasse für Client sowie Server, welche ihr KnowHow in den abgeleiteten Klassen 'lernt'.
Definition TcpMain.h:87
unsigned int getPortNum() const
void setWSACleanup() const
SOCKET m_MainSocket
Definition TcpMain.h:190
virtual void setDataSize(unsigned int uiDataSize)
TcpMain(const TcpMain &)
SOCKET getMainSocket() const
int startWinsock() const
virtual ~TcpMain()
int m_iSecTimeOut
Definition TcpMain.h:120
virtual int send(Message *pTcpMessage)=0
unsigned int m_uiServerPort
Definition TcpMain.h:133
int m_iSocketType
Definition TcpMain.h:168
TcpMain(unsigned int uiPort, int iAdressFamily, int iSocketType, int iProtocol, int iSecTimeOut)
unsigned int m_uiDataSize
Definition TcpMain.h:146
int m_iAdressFamily
Definition TcpMain.h:157
int TimeOutSec()
static unsigned int m_uiTcpMainCounter
Definition TcpMain.h:104
unsigned int getDataSize() const
TcpMain(unsigned int uiPort, int iAdressFamily, int iSocketType, int iProtocol, unsigned int uiDataSize, int iSecTimeOut)
void setTimeOutSec(int iSecTimeOut)
int m_iProtocol
Definition TcpMain.h:179
Definition TcpClient.h:55