66 lines
1.4 KiB
C++
66 lines
1.4 KiB
C++
//
|
|
// TCP Server
|
|
//
|
|
|
|
/* prevent multiple inclusions */
|
|
#ifndef __UdpServer__
|
|
#define __UdpServer__
|
|
|
|
/* includes *****************************************************************/
|
|
|
|
#include "UdpSocket.h"
|
|
#include "Daemon.h"
|
|
#include "Server.h"
|
|
|
|
/* defines ******************************************************************/
|
|
|
|
/* macros *******************************************************************/
|
|
|
|
/* structs & typedefs *******************************************************/
|
|
|
|
/* c class definitions ******************************************************/
|
|
|
|
class UdpServer : public Server, public UdpSocket {
|
|
// public data
|
|
public:
|
|
|
|
// protected data
|
|
protected:
|
|
|
|
// private data
|
|
private:
|
|
|
|
// static data
|
|
|
|
// public methods
|
|
public:
|
|
// constructors
|
|
UdpServer();
|
|
UdpServer( const char *host, const char *service );
|
|
|
|
// destructor
|
|
virtual ~UdpServer();
|
|
|
|
// public methods
|
|
int ServiceUri( const char *uri );
|
|
int Service( const char *host, const char *service=NULL );
|
|
int Listen( void );
|
|
int Restart( void );
|
|
|
|
// virtual functions
|
|
virtual int ClientSock( int sock ) {return 0;};
|
|
virtual int ClientInOut( char *buf, int n, int max ) {return n;};
|
|
|
|
// exceptions
|
|
class UdpServerException
|
|
{
|
|
char *toString(void) { return strerror(errno); };
|
|
};
|
|
|
|
// static methods
|
|
|
|
private:
|
|
};
|
|
|
|
#endif
|