00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023 #include "socket.hh"
00024
00025 #ifndef LIBSOCKET_WIN
00026
00027 #ifndef LOCAL_SOCKET_HH_
00028 # define LOCAL_SOCKET_HH_
00029
00030 namespace Network
00031 {
00034 class LocalSocket : public Socket
00035 {
00036 public:
00037 LocalSocket() :
00038 Socket(LOCAL), _filename("")
00039 {}
00040 LocalSocket(PROTO_KIND pkind) :
00041 Socket(LOCAL, pkind), _filename("")
00042 {}
00043
00044 virtual ~LocalSocket()
00045 {
00046 close();
00047 }
00048
00049 public:
00051 void writeto(const std::string& str,
00052 const std::string& filename);
00053
00056 std::string read();
00058 std::string read(int timeout);
00060 std::string read(std::string& filename);
00063 std::string read(std::string& filename, int timeout);
00066 std::string readn(unsigned int size);
00069 std::string readn(int timeout, unsigned int size);
00072 std::string readn(std::string& filename, unsigned int size);
00076 std::string readn(std::string& filename, int timeout, unsigned int size);
00077
00179
00180 void init(const std::string& filename);
00182 void close();
00183
00184 protected:
00190 int _bind(const std::string& filename);
00194 std::string _read_line(int socket);
00199 std::string _read_line(int socket, std::string& filename);
00203 std::string _read_line_bin(int socket, unsigned int size);
00208 std::string _read_line_bin(int socket, std::string& filename,
00209 unsigned int pkg_size);
00214 void _write_str(int socket, const std::string& str,
00215 const std::string& filename) const;
00220 void _write_str_bin(int socket, const std::string& str,
00221 const std::string& filename) const;
00222
00223 protected:
00224 std::string _filename;
00225 };
00226 }
00227
00228 #endif
00229 #endif