Skip to content

Simple implementation of RMI api of Java in Python

Notifications You must be signed in to change notification settings

mahyarkarimi/python-rmi

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Simple implementation of RMI api of Java in Python

This project is a simple copy of remote method invocation api of Java programming language written in python. it mimics the basic functionality of creating remote registry of objects at server to obtain on client.

Basic usage

Server

from rmi import LocateRegistry, UnicastRemoteObject
import time

class MyMath():
    def sum(self, *num):
        return sum(num)


if __name__ == '__main__':
    registry = LocateRegistry.create_registry(port=1099)
    my_math_stub = UnicastRemoteObject.export_object(MyMath())
    registry.rebind(my_math_stub, "math")
    print('list of remote object names in registry:', registry.list())

Client

from rmi import LocateRegistry

if __name__ == "__main__":
    registry = LocateRegistry.get_registry("10.0.75.1", 1099)
    my_math = registry.lookup("math")
    print('sum of [1,2,3] is ', my_math.sum(1, 2, 3))

About

Simple implementation of RMI api of Java in Python

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages