QApolloSocketClient.hh
Go to the documentation of this file.00001
00002 #ifndef _QAPOLLOSOCKETCLIENT_HH_
00003 #define _QAPOLLOSOCKETCLIENT_HH_
00004
00005 #include "QCuore.hh"
00006
00007 #include <string>
00008
00015 class QApolloSocketClient
00016 {
00017 public:
00018
00020 QApolloSocketClient();
00021
00023 QApolloSocketClient(const std::string& address, const std::string& port);
00024
00026 virtual ~QApolloSocketClient();
00027
00029 bool Write(const std::string& Cmd);
00030
00032 std::string Read() const;
00033
00034 const std::string& GetServerPort() const { return fServerPort; }
00035 const std::string& GetServerAddress() const { return fServerAddress; }
00036
00037 void SetServerPort (const std::string& s) { fServerPort = s; }
00038 void SetServerAddress(const std::string& s) { fServerAddress = s; }
00039
00044 int Open();
00045
00047 bool Close();
00048
00049 protected:
00050
00051 int socketDescr;
00052
00053 private:
00054 std::string fServerAddress;
00055 std::string fServerPort;
00063 int ReadLine(char* data, int max_len) const;
00064
00069 bool Write(const char* buffer, int len);
00070
00071 };
00072 #endif