pFad - Phone/Frame/Anonymizer/Declutterfier! Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

URL: http://github.com/hvishwanath/msgpack-rpc-python/tree/master

css" /> GitHub - hvishwanath/msgpack-rpc-python: MessagePack RPC implementation for Python · GitHub
Skip to content

hvishwanath/msgpack-rpc-python

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

79 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Unix Domain Socket support

Unix domain socket support is now available for msgpack-rpc. Sample examples below.

UDS examples

Server

import msgpackrpc.udsaddress
from msgpackrpc.transport import uds
class SumServer(object):
    def sum(self, x, y):
        return x + y

# Use builder as uds. default builder is tcp which creates tcp sockets
server = msgpackrpc.Server(SumServer(), builder=uds)
# Use UDSAddress instead of msgpackrpc.Address
server.listen(msgpackrpc.udsaddress.UDSAddress('/tmp/exrpc'))
server.start()

Client

import msgpackrpc.udsaddress
from msgpackrpc.transport import uds

#Use UDSAddress instead of default Address object
client = msgpackrpc.Client(msgpackrpc.udsaddress.UDSAddress("/tmp/exrpc"), builder=uds)
result = client.call('sum', 1, 2)  # = > 
print "Sum of 1 and 2 : %d" % result

Go through the below sections for general usage of Message Pack RPC Library

MessagePack RPC for Python

MessagePack RPC implementation based on Tornado.

Installation

% python setup.py install

or

% easy_install msgpack-rpc-python

Dependent modules

  • msgpack-python (>= 0.3)
  • tornado (>= 3)

Example

Server

import msgpackrpc

class SumServer(object):
    def sum(self, x, y):
        return x + y

server = msgpackrpc.Server(SumServer())
server.listen(msgpackrpc.Address("localhost", 18800))
server.start()

Client

import msgpackrpc

client = msgpackrpc.Client(msgpackrpc.Address("localhost", 18800))
result = client.call('sum', 1, 2)  # = > 3

Run test

In test directory:

% PYTHONPATH=../ python test_msgpackrpc.py

Run with timeout test(Timeout test takes about 5 seconds)

% PYTHONPATH=../ python test_msgpackrpc.py --timeout-test

Performance

OS: Mac OS X ver 10.8.3
CPU: Intel Core i7 2.7 GHz
Memory: 16 GB 1600 MHz DDR3

call(QPS)async(QPS)notify(QPS)
2.7.35903604024877
3.3.05493581223634
PyPy 1.9.0 with GCC 4.2.15519972946406

Test code are available in example directory(bench_client.py and bench_server.py).

TODO

  • Add advanced return to Server.
  • UDP, UNIX Domain support
  • Utilities (MultiFuture, SessionPool)

Copyright

AuthorMasahiro Nakagawa
CopyrightCopyright (c) 2011- Masahiro Nakagawa
LicenseApache License, Version 2.0

About

MessagePack RPC implementation for Python

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages

  • Python 100.0%
pFad - Phonifier reborn

Pfad - The Proxy pFad © 2024 Your Company Name. All rights reserved.





Check this box to remove all script contents from the fetched content.



Check this box to remove all images from the fetched content.


Check this box to remove all CSS styles from the fetched content.


Check this box to keep images inefficiently compressed and original size.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy