How To get port of the RMI Server?

Alex Co <[email protected]> Wed, 15 Apr 2009 02:09:34 -0600
Newsgroups gmane.comp.java.sun.rmi
Message-ID <LISTSERV%[email protected]>
Hi,

I have a rmi client and server working using stub on server side.

Now I would like to get the rmi listening server port to try to connect t=
o it via=20
sockets=20
to make some experiences...

The Server object:

public class HelloWorldServer extends UnicastRemoteObject implements=20
HelloWorld

When we make this:

HelloWorldServer obj =3D new HelloWorldServer();
Naming.rebind("HelloWorld", obj);

we are registring the server object into rmiregistry, hence, passing the =
rmi=20
server=20
listening port, right?

Having a

HelloWorldServer obj  object, how can i get its listenning port by using =
java=20
code?

Many thanks

Alex

=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
To unsubscribe, send email to [email protected] and include in the body
of the message "signoff RMI-USERS".  For general help, send email to
[email protected] and include in the body of the message "help".

For a list of frequently asked RMI questions please refer to:
http://java.sun.com/j2se/1.3/docs/guide/rmi/faq.html

To view past RMI-USERS postings, please see:
http://archives.java.sun.com/archives/rmi-users.html