If host is just the name of the server, which is bound to registry, then can you please explain what is Name here:
No, the host is the name of the
physical server, i.e, the name of the computer. As I recommended, look up the name of
your computer so that you are not confused. What you bind to the registry is the remote object. For some reson, many people are confused with the concept of registry and binding to it. It couldn't be simpler, -- loosely speaking, the registry is just a block of memory where you make your objects available for everyone to see. The registry is organized as a map, where your key is the name of you object (any
String, such as "my object"), and and the value is the actual object. Thus, to bind an object to registry, all you need to do is:
registry.bind("my object", myObject);
Notice that you don't need to specify the machine name or port, because the object is bound on
this machine. Now, to retreve the object from another machine, you must specify the machine name (such as "fatBrain", or 170.3.133.169), the port (such as 1099), and the name to which the object is mapped ("my object"):
String service = "//" + "fatBrain" + ":" + 1099 + "/" + "my object";
myObject = (MyObjectInterface) Naming.lookup(service);
That's all there is to it, -- one line of code for bind(), two lines for lookup(). The client needs to know the server name to connect, of course.
Eugene.
[ April 01, 2003: Message edited by: Eugene Kononov ]