Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Java > RMI: take ip/hostname what client was using and give it back as aremote objects hostname

Reply
Thread Tools

RMI: take ip/hostname what client was using and give it back as aremote objects hostname

 
 
AWieminer
Guest
Posts: n/a
 
      07-12-2005
RMI: take ip/hostname what client was using and give it back as a remote
objects hostname. Long question but here is what I try to ask.

Currently I use the following code to start RMIRegistry inside my
application and bind Remote objects. I can bind several objects to the
same port. Actually, I run a rmi registry lookup and remote object
"handles" in a same fixed port. Its more NAT-firewall friendly.

When clients lookup a remote object handle from the registry, they
receive a hostname where given service is running. It is a server that
tells them to use that hostname. This is a small problem in a
NAT-firewall world.

I must use "-Djava.rmi.server.hostname=myPublicHostName.com" commandline
parameter to override internal hostname seen by the server machine. It
would give internal DMZ ip address if not overriden this way.

Best method would use the same hostname what client was using the first
place when connected to RMI registry to look for remote handles. It is
after all an address it can use when connecting to our server.

Is it possible to take that ip/hostname and give it back along with the
remoteobject's hostname?

- - - -
Registry reg;

public void createReg(int port) throws Exception {
try {
reg = LocateRegistry.createRegistry(port); // registry port number
} catch (Exception ex) {
// probably was already running so take existing registry instance.
reg = LocateRegistry.getRegistry(port);
}
}

public void bindService(String id, int port) thows Exception {
Remote obj = createMyRemoteImplementationXX();
UnicastRemoteObject.exportObject(obj, port);
reg.rebind(id, obj);
}
- - - -
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Generate HTML and give it back to client Barbiturico76 ASP .Net 2 07-29-2008 02:53 PM
take hostname, look if folder exsist, if not create and copy files Paw ASP General 8 05-31-2006 02:09 PM
Trouble using a hostname in the address field for the Radius client in IAS Ned Cisco 0 08-11-2005 02:59 PM
Give us 3 minutes; we give you the whole library lib Computer Support 1 02-04-2005 03:16 AM
Give us 3 minutes; we give you the whole library lib Computer Support 0 01-27-2005 07:52 AM



Advertisments