64 lines
1.3 KiB
C++
64 lines
1.3 KiB
C++
//
|
|
// TCP Client
|
|
//
|
|
|
|
/* prevent multiple inclusions */
|
|
#ifndef __UdpClient__
|
|
#define __UdpClient__
|
|
|
|
/* includes *****************************************************************/
|
|
|
|
#include "UdpSocket.h"
|
|
#include "Client.h"
|
|
|
|
/* defines ******************************************************************/
|
|
|
|
/* macros *******************************************************************/
|
|
|
|
/* structs & typedefs *******************************************************/
|
|
|
|
/* c class definitions ******************************************************/
|
|
|
|
class UdpClient : public Client, public UdpSocket {
|
|
// public data
|
|
public:
|
|
|
|
// protected data
|
|
protected:
|
|
|
|
// private data
|
|
private:
|
|
|
|
// static data
|
|
|
|
// public methods
|
|
public:
|
|
// constructors
|
|
UdpClient();
|
|
UdpClient( const char *host, const char *service );
|
|
|
|
// destructor
|
|
virtual ~UdpClient();
|
|
|
|
// public methods
|
|
int ConnectUri( const char *uri );
|
|
int Connect( const char *host, const char *service=NULL );
|
|
int Reconnect() { Close();return Connect(GetHost(),GetPort()); };
|
|
int ListenUri( const char *uri );
|
|
int Listen( const char *host, const char *port );
|
|
|
|
// virtual functions
|
|
|
|
// exceptions
|
|
class UdpClientException
|
|
{
|
|
char *toString(void) { return strerror(errno); };
|
|
};
|
|
|
|
// static methods
|
|
|
|
private:
|
|
};
|
|
|
|
#endif
|