61 lines
1.2 KiB
C++
61 lines
1.2 KiB
C++
//
|
|
// TCP Thread
|
|
//
|
|
|
|
/* prevent multiple inclusions */
|
|
#ifndef __TcpThread__
|
|
#define __TcpThread__
|
|
|
|
/* includes *****************************************************************/
|
|
|
|
#include "TcpClient.h"
|
|
#include "Thread.h"
|
|
|
|
/* defines ******************************************************************/
|
|
|
|
/* macros *******************************************************************/
|
|
|
|
/* structs & typedefs *******************************************************/
|
|
|
|
/* c class definitions ******************************************************/
|
|
|
|
class TcpThread : public TcpClient, public Thread {
|
|
// public data
|
|
public:
|
|
|
|
// protected data
|
|
protected:
|
|
|
|
// private data
|
|
private:
|
|
|
|
// static data
|
|
|
|
// public methods
|
|
public:
|
|
// constructors
|
|
TcpThread();
|
|
|
|
// destructor
|
|
virtual ~TcpThread();
|
|
|
|
// public methods
|
|
void SetSocket( int sock ) {Socket::SetSocket(sock);};
|
|
int Detach(void) {return pthread_detach(pthread_self());};
|
|
|
|
// virtual functions
|
|
virtual void *Run(void *);
|
|
|
|
// exceptions
|
|
class TcpThreadException
|
|
{
|
|
char *toString(void) { return strerror(errno); };
|
|
};
|
|
|
|
// static methods
|
|
|
|
private:
|
|
};
|
|
|
|
#endif
|