Más contenido relacionado
La actualidad más candente (20)
Thrift
- 8. サーバーのスケルトン #include "Hello.h" /* 中略 */ class HelloHandler : virtual public HelloIf { public: HelloHandler() { // Your initialization goes here } void hello(std::string& _return, const std::string& name) { // Your implementation goes here printf("hello"); } }; int main(int argc, char **argv) { int port = 9090; /* ... 以下略 ...*/
- 10. サーバーコンパイル , 立ち上げ % g++ -g Hello_server.cpp Hello.cpp > -o Hello_server > -lthrift > -I/usr/local/include/thrift % ./Hello_server
- 11. 4. Perl でクライアントを書く use lib './gen-perl'; ## Thrift インストール時にインストールされているライブラリ群 use Thrift; use Thrift::BinaryProtocol; use Thrift::Socket; ## IDL から gen-perl/ 以下に生成されたライブラリ use Hello; my $transport = Thrift::Socket->new('localhost', 9090); my $client = HelloClient->new( Thrift::BinaryProtocol->new($transport) ); $transport->open(); printf "%s", $client->hello("naoya") ; $transport->close();