예제 #1
0
def msgpack_client():  # メッセージバックによるRPC実装のクライアント
    from msgpackrpc import Client, Address

    client = Client(Address("localhost", 6789))  # サーバーに接続
    num = 8
    result = client.call('double', num)  # double をリモート呼び出し
    print("Double %s is %s" % (num, result))
예제 #2
0
def msgpack_server():  # メッセージバックによるRPC実装のサーバー
    from msgpackrpc import Server, Address

    class Services():
        def double(self, num):
            return num * 2

    server = Server(Services())  # ServicesクラスのメソッドをRPCサービスとして提供
    server.listen(Address("localhost", 6789))  # localhost:6789でリスン
    server.start()
예제 #3
0
from msgpackrpc import Server, Address

class Services():
    def double(self, num):
        return num * 2

server = Server(Services())
server.listen(Address("localhost", 6789))
server.start()
from msgpackrpc import Server, Address


class Services():
    def double(self, num):
        return num * 2


server = Server(Services())
server.listen(Address('localhost', 6789))
server.start()
예제 #5
0
# -*- coding: utf-8 -*-
"""
msgpack_client.py
Created on Sat Apr 20 11:19:17 2019

@author: madhu
start /b python msgpack_server.py
python xmlrpc_client.py
"""
from msgpackrpc import Client, Address

host_name = 'localhost'
port_num = 6789

client = Client(Address(host_name, port_num))
num = 8
result = client.call('double', num)
print("Double %s is %s" % (num, result))

예제 #6
0
from msgpackrpc import Client, Address

client = Client(Address('localhost', 6789))
num = 8
result = client.call('double', num)
print("double %s is %s" % (num, result))
예제 #7
0
# -*- coding: utf-8 -*-
"""
msgpack_server.py
Created on Sat Apr 20 11:19:17 2019

@author: madhu
start /b python msgpack_server.py
python xmlrpc_client.py
"""
from msgpackrpc import Server, Address

class Services():
    def double(self, num):
        return num * 2

host_name = 'localhost'
port_num = 6789

server = Server(Services())
server.listen(Address(host_name, port_num))
server.start()
#!/usr/bin/env python3
#-*- coding:utf-8 -*-
# Created by nobuskate on 2018/01/19.

# import
from msgpackrpc import Client, Address

client = Client(Address("localhost", 6789))
num = 8
result = client.call('double', num)
print("Double %s is %s" % (num, result))
예제 #9
0
# RPC Server
from msgpackrpc import Server, Address


class Services():
    def double(self, num):
        return num * 2


server = Server(Services())
server.listen(Address("localhost", 6789))
server.start()

# RPC Client
from msgpackrpc import Client, Address

client = Client(Address("localhost", 6789))
num = 8
result = client.call('double', num)
print("Double %s is %s" % (num, result))