61
General Discussion / a sample for build p2p network based nanomsg
« on: September 29, 2015, 06:33:00 am »
nanomsg is a real zero-copy msg server
so I write a simple demo for howto implement a p2p network based this.
https://github.com/pch957/nanomsg_p2pnode
wish this can help improve the p2p network's efficient.
Quote
Zero-Copyand it support mode "bus", http://tim.dysinger.net/posts/2013-09-16-getting-started-with-nanomsg.html
While ZeroMQ offers a "zero-copy" API, it's not true zero-copy. Rather it's "zero-copy till the message gets to the kernel boundary". From that point on data is copied as with standard TCP. nanomsg, on the other hand, aims at supporting true zero-copy mechanisms such as RDMA (CPU bypass, direct memory-to-memory copying) and shmem (transfer of data between processes on the same box by using shared memory). The API entry points for zero-copy messaging are nn_allocmsg and nn_freemsg functions in combination with NN_MSG option passed to send/recv functions.
so I write a simple demo for howto implement a p2p network based this.
https://github.com/pch957/nanomsg_p2pnode
wish this can help improve the p2p network's efficient.