00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #ifndef __tcp_rpc_client_hpp
00021 #define __tcp_rpc_client_hpp
00022
00023 #include "iobase.hpp"
00024
00025 #ifdef WIN32
00026 #include <windows.h>
00027 #include <winsock2.h>
00028 #else
00029 #include <netinet/in.h>
00030 #include <arpa/inet.h>
00031 #endif
00032
00033 #include "tcparchivestream.hpp"
00034 #include "streamconstructor.hpp"
00035
00036 #include <string>
00037
00038 #include <mynahsa/spimpl.hpp>
00039
00040
00041 namespace MynahSA {
00047 class TCPRPCClient {
00048 public:
00056 TCPRPCClient(const StreamConstructor& sc,
00057 unsigned int ipaddress,
00058 unsigned int port);
00059
00060
00068 TCPRPCClient(const StreamConstructor& sc,
00069 std::string machineName,
00070 unsigned int port);
00071
00073 ~TCPRPCClient();
00074
00076 SHARED_PTR<IoBase> rpc(SHARED_PTR<IoBase> req);
00077
00079 bool is_open() const { return _isopen; }
00080
00082 void close();
00083
00084
00085 private:
00087 void init(const StreamConstructor& sc,
00088 unsigned int ipaddress,
00089 unsigned int port);
00090
00092 bool _isopen;
00093
00095 int _sd;
00096
00098 SHARED_PTR<TCPArchiveStream> _stream;
00099
00100 };
00101 };
00102
00103 #endif