How to cleanly close a client in ripeRMI

107 views
Skip to first unread message

francois...@gmail.com

unread,
Dec 10, 2013, 8:21:04 PM12/10/13
to js...@googlegroups.com
Hello,

I am playing with the ripeRMI remake of the lipeRMI library (ripeRMI works great!).

But, I am having some trouble finding how to cleanly perform an operation.

In lipeRMI, whenever a client is done (Ex. it's windows is closed), I would call the Client.close() method to close the connection between client and server.

But, in the ripeRMI version, if I perform Client.close(), I immediately get a SocketException (socket closed) on the client side. Everything else seems to work fine, but I since I get an Exception thrown at me, I guess this is not the proper way to do things.

As an alternative, I tried to skip the Client.close() instruction on my client and just let the client terminates (without explicitly closing the connection). In this case, my client closes nicely, but I get a SocketException (connection reset) on the server.

So, all this leads me to believe that I am doing something not the proper way. My question is thus:

How to cleanly close a client in ripeRMI ?

My very simple test example is HelloWorld.

Server code is:
            CallHandler callHandler = new CallHandler();
            callHandler.registerGlobal(IServer.class, this);
            Server server = new Server();
            server.bind(12345, callHandler);
            Thread.sleep(100000);

Client code is:
            CallHandler callHandler = new CallHandler();
            Client client = new Client("127.0.0.1", 12345, callHandler);
            IServer myServiceCaller = client.getGlobal(IServer.class);
            myServiceCaller.sayHello();
            //client.close();

Any suggestions/comments/inputs/explanations would be much appreciated.

Thanks !

Reply all
Reply to author
Forward
0 new messages