server.h
00001 #ifndef UTILS_IPC_SERVER_H
00002 #define UTILS_IPC_SERVER_H
00003
00004 #include <string>
00005 #include <stdexcept>
00006
00007 namespace Utils
00008 {
00009 namespace IPC
00010 {
00011 class PacketCollection;
00015 class Server
00016 {
00017 public:
00022 explicit Server(const std::string& serverName);
00026 ~Server();
00034 void ReadRequest(PacketCollection& packets, unsigned timeout = 0);
00041 void SendReply(const PacketCollection& packets, unsigned timeout = 1);
00046 void CloseConnection();
00047
00048 private:
00049 const std::string ServerName_;
00050 };
00051
00055 class ServerError
00056 : public std::runtime_error
00057 {
00058 public:
00063 ServerError(const std::string& message)
00064 : std::runtime_error(message)
00065 {
00066 }
00067 };
00068 }
00069 }
00070
00071 #endif//UTILS_IPC_SERVER_H