Hi , I understand how rmi works. The client requests an object by name to the RMI registry, once the client has the stub it make calls to the remotes method.I have gone through the RMI specification doc and underneath it actually opens a socket, but who determines on which port it shoud talk?..Is this done at compile time and run time? Can someone explain in detail. Thanks for your time Thanks Praveen.
Joined: Jan 30, 2002
Hi Praveen, Well I don't pretend to be an expert on RMI but I will tell you what little I do know about RMI and ports. The RMI registry is bound to port 1099 by default but can be bound to virtually any available port on the system. Now when a client requests a connection to a service that is bound to the RMI registry then the RMI server usually opens an anonymous port (which is whatever available port the system gives it) for that client to communicate with the remote service. It's like you creating a ServerSocket like:
This is why RMI has such a hard time with firewalls. Nobody knows for sure what ports are going to be needed. When this problem arises though custom SocketFactories can be implemented to use selected ports. Hope this helps, Michael Morris
Any intelligent fool can make things bigger, more complex, and more violent. It takes a touch of genius - and a lot of courage - to move in the opposite direction. - Ernst F. Schumacher