00001
00002
00003
00004
00005
00006
00007
00008
00018 #ifndef _SocketClient_h_
00019 #define _SocketClient_h_
00020
00021 #include <sys/types.h>
00022 #include <sys/socket.h>
00023 #include <netinet/in.h>
00024 #include <netdb.h>
00025
00026 #include <string>
00027
00028 namespace edg {
00029 namespace workload {
00030 namespace common {
00031 namespace socket_pp {
00032
00034 class SocketAgent;
00035
00044 class SocketClient
00045 {
00046 public:
00047
00053 SocketClient(const std::string&, int);
00058 virtual ~SocketClient();
00059
00065 bool Send(const std::string&);
00066
00072 bool Send(int);
00078 bool Send(long);
00084 bool Receive(int&);
00090 bool Receive(long&);
00091
00097 bool Receive(std::string&);
00098
00103 virtual bool Open();
00108 virtual bool Close();
00109
00115 bool SetTimeout(size_t secs);
00120 std::string Host() const { return host; }
00125 SocketAgent* getAgent() const;
00126
00127 protected:
00134 bool AttachAgent(SocketAgent*);
00135
00136 public:
00138 const std::string host;
00140 const int port;
00141
00142 protected:
00144 SocketAgent *agent;
00145 };
00146
00147 }
00148 }
00149 }
00150 }
00151
00152 #endif
00153
00154
00155
00156
00157
00158
00159