Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Java > RMI host binding question

Reply
Thread Tools

RMI host binding question

 
 
G
Guest
Posts: n/a
 
      06-18-2007
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

 
Reply With Quote
 
 
 
 
Gordon Beaton
Guest
Posts: n/a
 
      06-18-2007
On Mon, 18 Jun 2007 06:55:30 -0700, G wrote:
> 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.


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 localhostort.

Note: I haven't actually tried this.

/gordon

--
 
Reply With Quote
 
 
 
 
Tom Hawtin
Guest
Posts: n/a
 
      06-18-2007
G wrote:
>
> 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:


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
 
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
Why does java.rmi.Naming not implement interface java.rmi.Registry? Jan Schulze Java 1 03-26-2005 07:45 AM
RMI Vs RMI over IIOP JScoobyCed Java 1 01-28-2005 09:54 AM
RMI, JINI or RMI/IIOP Buu Nguyen Java 1 08-25-2004 11:28 AM
RMI binding to SAME port but DIFFERENT IP address on SAME host Alexander N. Spitzer Java 21 08-16-2004 12:41 AM
Restricting RMI calls by host Mark McKay Java 0 09-25-2003 11:11 PM



Advertisments