tags:

views:

418

answers:

1

Hi,

I have a java 1.4 RMI application. By using custom socket factory, I am running my RMI server in a particular port (5050).

The problem is, when the RMI client application tries to communicate to RMI server from a different machine, random ports are being opened up in the client machine (Can see through TCPView.exe). Since, firewall blocked all the ports in the client machine, the application is not working. If I turn-off the firewall in client machine, the application works well.

I found this topic is discussed in many forums, but nowhere I found the solution for client side.

Is there any sample code/application available to explain, how to run RMI client in a particular port?

Thanks in advance

Raja Balu

+3  A: 

The problem is, I believe, that the initial RMI server port (5050 in your case) is only used for the initial connection from the client. Once that has been established, the server creates a new socket on a random port, and hands off the client to that.

You need to further modify your server-side socket factory so that the hand-off sockets are given a specific port in addition to the initial port 5050. This port will also need to be visible through your firewall.

This article seems to cover that.

skaffman
Thanks for your response. I don't have any problem with my RMI server, its working well in the same port as I expected. My problem is with the client machine, where my RMI client is running. When I run the RMI client for the first time (after turn-off the firewall), it opens a port say 3030, If I run the client for 2nd time it opens another random port say 3035. If I turn-on the firewall, no ports are being opened in the client machine, as well as the application is also not working.
Raja Balu