msgpack-rpc-0.3.0

所属分类:Windows编程
开发工具:C/C++
文件大小:347KB
下载次数:12
上传日期:2011-04-01 10:47:02
上 传 者wl97
说明:  号称性能最强悍的序列化反序列化sdk,比protobuf的性能还高出4倍
(Called the performance the most powerful serialization deserialization sdk, the performance is also higher than protobuf 4 times)

文件列表:
msgpack-rpc-0.3.0\ac\compile (3769, 2010-08-12)
msgpack-rpc-0.3.0\ac\config.guess (44941, 2010-08-12)
msgpack-rpc-0.3.0\ac\config.sub (34423, 2010-08-12)
msgpack-rpc-0.3.0\ac\depcomp (18615, 2010-08-12)
msgpack-rpc-0.3.0\ac\install-sh (13663, 2010-08-12)
msgpack-rpc-0.3.0\ac\ltmain.sh (243248, 2010-08-12)
msgpack-rpc-0.3.0\ac\missing (11419, 2010-08-12)
msgpack-rpc-0.3.0\aclocal.m4 (318179, 2010-08-16)
msgpack-rpc-0.3.0\AUTHORS (55, 2010-08-12)
msgpack-rpc-0.3.0\ChangeLog (591, 2010-08-16)
msgpack-rpc-0.3.0\config.h.in (2386, 2010-08-16)
msgpack-rpc-0.3.0\configure (539722, 2010-08-16)
msgpack-rpc-0.3.0\configure.in (3846, 2010-08-16)
msgpack-rpc-0.3.0\COPYING (596, 2010-08-12)
msgpack-rpc-0.3.0\INSTALL (15578, 2010-08-12)
msgpack-rpc-0.3.0\Makefile.am (91, 2010-08-12)
msgpack-rpc-0.3.0\Makefile.in (22672, 2010-08-16)
msgpack-rpc-0.3.0\NEWS (0, 2010-08-12)
msgpack-rpc-0.3.0\src\cclog\cclog.cc (930, 2010-08-12)
msgpack-rpc-0.3.0\src\cclog\cclog.h (10038, 2010-08-12)
msgpack-rpc-0.3.0\src\cclog\cclog.hmpl (3494, 2010-08-12)
msgpack-rpc-0.3.0\src\cclog\cclog_null.cc (836, 2010-08-12)
msgpack-rpc-0.3.0\src\cclog\cclog_null.h (860, 2010-08-12)
msgpack-rpc-0.3.0\src\cclog\cclog_ostream.cc (942, 2010-08-12)
msgpack-rpc-0.3.0\src\cclog\cclog_ostream.h (954, 2010-08-12)
msgpack-rpc-0.3.0\src\cclog\cclog_syslog.cc (1284, 2010-08-12)
msgpack-rpc-0.3.0\src\cclog\cclog_syslog.h (971, 2010-08-12)
msgpack-rpc-0.3.0\src\cclog\cclog_tty.cc (2003, 2010-08-12)
msgpack-rpc-0.3.0\src\cclog\cclog_tty.h (930, 2010-08-12)
msgpack-rpc-0.3.0\src\cclog\Makefile.am (354, 2010-08-12)
msgpack-rpc-0.3.0\src\cclog\Makefile.in (18956, 2010-08-16)
msgpack-rpc-0.3.0\src\Makefile.am (85, 2010-08-12)
msgpack-rpc-0.3.0\src\Makefile.in (16941, 2010-08-16)
msgpack-rpc-0.3.0\src\msgpack\rpc\address.cc (4139, 2010-08-12)
msgpack-rpc-0.3.0\src\msgpack\rpc\address.h (6892, 2010-08-12)
msgpack-rpc-0.3.0\src\msgpack\rpc\caller.h (57160, 2010-08-12)
msgpack-rpc-0.3.0\src\msgpack\rpc\caller.hmpl (3137, 2010-08-12)
msgpack-rpc-0.3.0\src\msgpack\rpc\client.cc (1760, 2010-08-13)
msgpack-rpc-0.3.0\src\msgpack\rpc\client.h (3588, 2010-08-12)
... ...

MessagePack-RPC for C++ ======================= ## Requirements Following programs are requred to build: - gcc >= 4.1 with C++ support - [MessagePack for C++](http://msgpack.sourceforge.net/) >= 0.5.0 - [mpio](http://github.com/frsyuki/mpio) >= 0.3.3 ## Installation Configure and install in the usual way: $ ./bootstrap # if needed $ ./configure $ make $ sudo make install ## Usage [Test cases](http://github.com/msgpack/msgpack-rpc/tree/master/cpp/test/) will give you a sample usage. - [echo server](http://github.com/msgpack/msgpack-rpc/blob/master/cpp/test/echo_server.h) - [synchronous method call](http://github.com/msgpack/msgpack-rpc/blob/master/cpp/test/sync_call.cc) - [asynchronous method call](http://github.com/msgpack/msgpack-rpc/blob/master/cpp/test/async_call.cc) - [callback-style method call](http://github.com/msgpack/msgpack-rpc/blob/master/cpp/test/callback.cc) - [notify](http://github.com/msgpack/msgpack-rpc/blob/master/cpp/test/notify.cc) ## Example ### Simple client #include #include int main(void) { msgpack::rpc::client c("127.0.0.1", 9090); int result = c.call("add", 1, 2).get(); std::cout << result << std::endl; } ### Simple server #include class myserver : public msgpack::rpc::server::base { public: void add(msgpack::rpc::request req, int a1, int a2) { req.result(a1 + a2); } public: void dispatch(msgpack::rpc::request req) try { std::string method; req.method().convert(&method); if(method == "add") { msgpack::type::tuple params; req.params().convert(¶ms); add(req, params.get<0>(), params.get<1>()); } else { req.error(msgpack::rpc::NO_METHOD_ERROR); } } catch (msgpack::type_error& e) { req.error(msgpack::rpc::ARGUMENT_ERROR); return; } catch (std::exception& e) { req.error(std::string(e.what())); return; } }; int main(void) { myserver svr; svr.instance.listen("0.0.0.0", 9090); svr.instance.run(4); // run 4 threads } IDL parser and code generator is under development. It will resolve the problem that users have to implement verbose dispatch() function. ## License Copyright (C) 2008-2010 FURUHASHI Sadayuki Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

近期下载者

相关文件


收藏者