This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Developer Certification (SCJD/OCMJD) and the fly likes RMI UnicastRemoteObject Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Certification » Developer Certification (SCJD/OCMJD)
Bookmark "RMI UnicastRemoteObject" Watch "RMI UnicastRemoteObject" New topic
Author

RMI UnicastRemoteObject

Radi Hadzhiyski
Ranch Hand

Joined: Jun 30, 2009
Posts: 47

Hello,

When i write my implementing class, that implements the interface, that implements the Remote, i have:



then i have to define a default constructor, that does nothing but defines the RemoteException:

or constructor that does something:


but this means i invoke because of the inheritance the default consttructor of the Unicast...:
Creates and exports a new UnicastRemoteObject object using an anonymous port.

but if i add the following to my constructors:

then because of the inheritance:
Creates and exports a new UnicastRemoteObject object using the particular supplied port.


-In both cases, my program runs well, what is the difference between anonymous port and particular supplied port?
-Should the particular supplied port be the same like this one by the createRegistry (on with the server listens for
incomming connections)?


SCJP 1.6 (91%), SCJD
Roel De Nijs
Bartender

Joined: Jul 19, 2004
Posts: 5139
    
  12

Hi Radi,

I didn't extend from UnicastRemoteObject. I just used the exportObject of it with port number 0.

And when I create the registry the port number (chosen by the user) comes into play. So don't think that value has any value (in this assignment).

Kind regards,
Roel


SCJA, SCJP (1.4 | 5.0 | 6.0), SCJD
http://www.javaroe.be/
Radi Hadzhiyski
Ranch Hand

Joined: Jun 30, 2009
Posts: 47
ok, the UnicastRemoteObject.exportObject(object, port) has the same meaning like
when you extend the UnicastRemoteObject and invoke the constructor with port, but
what this port means, is an enigma for me
Apparently this has nothing to do with the port by the createRegistry thing, because it works
in the both way, but anyway...
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: RMI UnicastRemoteObject
 
Similar Threads
URLyBird's [Version 1.2.3] and network side
RMI behind NAT
Exporting Objects on same port as RMI Registry
RMI method invocation return value
scjd questions