Re: How To get port of the RMI Server?

Alex Co <[email protected]> Thu, 16 Apr 2009 02:17:42 -0600
Newsgroups gmane.comp.java.sun.rmi
Message-ID <LISTSERV%[email protected]>
EJP, I didnt knew that a person that puts a question on the mailling list=
 must=20
justify why it is making that question, hence, i sorry for that.

I know that RMI system uses a wire protocol. Do not worry about that! I a=
m=20
fine with that!=20

I just want to know who can i get the port that RMI server is listenning =
to.

In this server source code:


import java.rmi.Naming;
import java.rmi.RemoteException;
import java.rmi.RMISecurityManager;
import java.rmi.server.UnicastRemoteObject;
import java.rmi.RemoteException;

public class HelloWorldServer extends UnicastRemoteObject implements=20
HelloWorld=20
{
=09public HelloWorldServer() throws RemoteException=20
=09{
=09=09super();
=09}

=09public void helloWorld()=20
=09{
=09=09System.out.println("Invocation to helloWorld was succesful!");
=09}

=09public static void main(String args[])=20
=09{
=09=09try=20
=09=09{
=09=09=09// Create an object of the HelloWorldServer class.
=09=09=09HelloWorldServer obj =3D new HelloWorldServer();

=09=09=09// Bind this object instance to the name "HelloServer".
=09=09=09Naming.rebind("HelloWorld", obj);

=09=09=09System.out.println("HelloWorld bound in registry");
=09=09}
=09=09catch (Exception e)=20
=09=09{
=09=09=09System.out.println("HelloWorldServer error: " +=20
e.getMessage());
=09=09=09e.printStackTrace();
=09=09}
=09}
}


Can i use the object obj  or Naming to get the listenning port?


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