SpiderMonkey RMI Implementation

Hi …

I’ve been trying to set up a simple client server system with SpiderMonkey and ZayES. I have setup and run the client / server example, but it soon became apparent that the server only sends data to client and there it ends. There is no return service there from the client to the server.

To this end, I was pointed toward learning RMI. It’s pretty easy actually, only four classes for a client server setup, one of those being an interface.

So I thought I’d try the SpiderMonkey RMI, thinking it should be just as easy. But working through the SimEtherial classes as examples has baffled me. I’ve been at it for the better part of a week and I’m feeling really frustrated.

I would use java’s RMI but I’ve read that it’s too slow for a gaming application.

Could someone post a simple working example, please? (Or point me to one if one already exists).

Thanks.

Either end works the same way in SpiderMonkey.

public interface Foo {
    public void doTheThing();
}

public class FooImpl implements Foo {
    public void doTheThing() {
        System.out.println("I'm doing the thing.");
    }
}

If you are on the client, you registry this with the client’s RMI registry and the server code using a HostedConnection can look it up. If you are on the server then you register it with the hosted connection’s RMI registry and the client can look it up.

The sim-eth examples do this. The server->client ones are the listeners.

And really if things get too hard then just send messages. That’s not hard either. It’s dirt-simple. Send a Message subclass from one end. Get it from the message listener on the other end. You will then have to do a lot of boiler plate and message routing to hosted connections and so on by yourself.