RMI - Remote Method Invocation
BlitzMax Forums/BlitzMax Programming/RMI - Remote Method Invocation
| ||
Hi, I wanted to have a library like RMI in BlitzMax. So I tried to make one. With remote method invocation you can link an object of your runtime to an object in another runtime (e.g. in another process / other machine) to call methods in other runtimes. Basically you let RMI do the networking and you just call methods. I've come pretty far and use it in my current project and since I already published it on the german site, I thought, I can share it here as well. I've programmed some other modules supporting RMI, so i release them all at once. DOWNLOAD FSCOM.Proxy To create RMI, you need proxy objects to redirect every method call to a function "send this method call". The proxy module has a program called buildproxies with it, that (internally uses the lexer of the BlitzMax IDE and) creates a proxy class of every type with the annotation {proxy}. Import fscom.proxy to use the function CreateProxy that initiallizes a proxy object for you to use. Buildproxies must be called whenever the a base type changes. It will follow import/includes so you just need to call it once for your project. FSCOM.Serialization & FSCOM.SerializationEx To send the parameters and the return values, I created this serilization module. It uses reflection and can handle cyclic and tree structures in objects. FSCOM.BufferedStream A replacement for brl.socketstream that buffers incoming and outgoing messages until Flush is called. FSCOM.Async & FSCOM.AsyncEx This Modules can be used to dispatch tasks to an executor that can execute these tasks whenever it wants and in whatever thread it wants. It wasn't 100% necessary but it was helpful and will be helpful for future extensions regarding threading. FSCOM.RMI Import fscom.rmi to import all features. Import just fscom.rmiclient or fscom.rmiserver to just use the client or server. The current implementation is just TCP. The server and the client can both register object services, so you can use RMI bidirectionally with one connection. The server can also register type services that will automatically register one service object per client, so you can easily recognize a client. Example: Documentation and windows binaries are in the package. Have fun. |
| ||
Very cool! I often use multiple processes to get around the Blitzmax's MT GC issues. This could be very useful. Thanks for sharing it! |
| ||
Fixed download link in OP (pointed to an old version). Added example in OP. |