Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / June 2007

Tip: Looking for answers? Try searching our database.

RMI host binding question

Thread view: 
G - 18 Jun 2007 14:55 GMT
Greetings,

I have code that starts the RMI registry as follows:

LocateRegistry.createRegistry(5000);

This works fine, however the registry listens on all interfaces at the
port 5000. I would like rmi registry to listen only on localhost
interface, in similar fashion to the way you can make MySQL and
Postfix listen only to localhost. For example a netstat -ta would
reveal:

Proto Recv-Q Send-Q Local Address           Foreign Address
State
tcp        0      0 localhost:mysql         *:*
LISTEN
tcp        0      0 *:www                   *:*
LISTEN
tcp        0      0 localhost:smtp          *:*
LISTEN
tcp        0      0 *:5000                 *:*
LISTEN
tcp6       0      0 *:ssh                   *:*
LISTEN

In other words I would like to see:

tcp        0      0 localhost:5000
*:*                     LISTEN

Does anyone know if rmi registry supports interface binding like this?
>From what I can tell, it does not.

Cheers,
Greg
Gordon Beaton - 18 Jun 2007 15:05 GMT
> In other words I would like to see:
>
[quoted text clipped - 3 lines]
> Does anyone know if rmi registry supports interface binding like this?
> From what I can tell, it does not.

From what I can tell you can use the other createRegistry() method,
and specify an RMIServerSocketFactory to create the actual
ServerSocket that's to be used. So you should be able to create one
that binds to localhost:port.

Note: I haven't actually tried this.

/gordon

--
Tom Hawtin - 18 Jun 2007 15:08 GMT
> I have code that starts the RMI registry as follows:
>
[quoted text clipped - 5 lines]
> Postfix listen only to localhost. For example a netstat -ta would
> reveal:

The other LocateRegistry.createRegistry is;

   public static Registry createRegistry(
       int port,
       RMIClientSocketFactory csf,
       RMIServerSocketFactory ssf
   )

So implement an RMIServerSocketFactory that creates server sockets bound
to the localhost address.

Tom Hawtin


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.