RMI Callback; reusing established client to server connection (workaround firewall / NAT)

J

Jo Voordeckers

Hello all,

I'm pretty new to the Java newsgroups so I apologize for dropping this
into several maybe offtopic groups. I'm sorry!

So on to my problem... I've come to a point in our RMI application where
I need to have server callbacks to the client RMI applications. I've
used the technique where the client passes an UnicastRemoteObject of
itself to a RMI server method that registers the clientinterface object
in a Vector. Now when I do this register in my home LAN all works fine
(callback methods are working), but when I connect from the office to my
home server the connection stalls at the point of the registermethod
with the callback object as parameter. No exceptions are thrown, the
client just freezes but the server keeps running just fine...

I then found several connection attepts from my home-server's IP to our
firewall/NAT router at the office originating from the clients RMI
SSL-connection assigned port. This makes me assume that the callback
technique in turn opens a new socket from server to client in stead of
just reusing the established connection.

Am I right or is my code missing something to prevent the extra
connection? And if I am right has anyone found a solution other than to
not use RMI and write to sockets directly?
 
A

Alex Molochnikov

Jo Voordeckers said:
Hello all,

I'm pretty new to the Java newsgroups so I apologize for dropping this
into several maybe offtopic groups. I'm sorry!

So on to my problem... I've come to a point in our RMI application where
I need to have server callbacks to the client RMI applications. I've
used the technique where the client passes an UnicastRemoteObject of
itself to a RMI server method that registers the clientinterface object
in a Vector. Now when I do this register in my home LAN all works fine
(callback methods are working), but when I connect from the office to my
home server the connection stalls at the point of the registermethod
with the callback object as parameter. No exceptions are thrown, the
client just freezes but the server keeps running just fine...

I then found several connection attepts from my home-server's IP to our
firewall/NAT router at the office originating from the clients RMI
SSL-connection assigned port. This makes me assume that the callback
technique in turn opens a new socket from server to client in stead of
just reusing the established connection.

Your assumption is correct. RMI tries to open new sockets on the client side
if you use callbacks.
Am I right or is my code missing something to prevent the extra
connection? And if I am right has anyone found a solution other than to
not use RMI and write to sockets directly?

There is no solution based on RMI. Your client is hidden behind a firewall.
Callbacks do not work across firewalls. See
http://java.sun.com/j2se/1.4.2/docs/guide/rmi/faq.html#firewallBoth

Consider using application-level proxy (described in the same source).

Alex Molochnikov
Gestalt Corporation
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,011
Latest member
AjaUqq1950

Latest Threads

Top