00001
00002
00003
00004
00005
00006
00007
00008 #ifndef _QAPOLLOSOCKETCLIENT_HH_
00009 #define _QAPOLLOSOCKETCLIENT_HH_
00010
00011
00012 #include "QCuore.hh"
00013
00014
00015 #include <string>
00016
00017 class QApolloSocketClient {
00018
00019 public:
00020
00022 QApolloSocketClient();
00024 QApolloSocketClient(const std::string& address, const std::string& port);
00025
00026
00027 virtual ~QApolloSocketClient();
00028
00033 int Open();
00034
00035
00036 bool Close();
00037
00038
00039 bool Write(const char*, int len);
00040 bool Write(const std::string& Cmd);
00041
00048 int ReadLine(char* data, int max_len) const;
00049
00057 std::string Read() const;
00058
00059 inline const std::string& GetServerPort() const {return fServerPort;}
00060 inline const std::string& GetServerAddress() const {return fServerAddress;}
00061
00062 inline void SetServerPort (const std::string& s) {fServerPort = s;}
00063 inline void SetServerAddress(const std::string& s) {fServerAddress = s;}
00064
00065 protected:
00066 int socketDescr;
00067
00068 private:
00069 std::string fServerAddress;
00070 std::string fServerPort;
00071 };
00072
00073 #endif // _QAPOLLOSOCKETCLIENT_HH_