Solved

RMI vs Socket Connection

Posted on 1997-07-25
6
2,079 Views
Last Modified: 2008-03-04
I would like to know the advantage of using RMI METHODOLOGY connecting  to the server over the SOCKET CONNECTION connecting to the server.  Is there any performance differences like speed, reliability... etc.

Because I am currently working in developing Java application implementing 3 tier architecture.
There is no database connectivity concept in this.

To fetch some info from lower tier to the uppermost tier
I feel RMI is better solution instead of Socket concept.

Some one please clear my doubt.

  Thanks in advance.
0
Comment
Question by:SBK
  • 4
6 Comments
 

Author Comment

by:SBK
ID: 1223818
Edited text of question
0
 

Author Comment

by:SBK
ID: 1223819
If I implement RMI my application is going to invoke a method in remote machine to do some sort of work.  I can accomplish the same by using java.io.* and java.net.* package.
How RMI is superior than SOCKET? or change by question like
What are the credits if I use RMI instead of normal SOCKET programming ?
0
 

Expert Comment

by:hleungta
ID: 1223820
From my experience there is no difference in term of speed
between both solution. They are both reliable.
Socket allows you to have clients written in C/C++ or any
other language and it's simple.
RMI : you must have Java client but if you have a lot of
    info. to transfer you will save a lot of time
     (you don't have to care about the protocol, parsing    
     your messages etc...). For OO programming this is
     a better solution
In conclusion, I prefer RMI because it is evolving !
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 

Author Comment

by:SBK
ID: 1223821
Please tell me clearly the merits and demerits of RMI and Socket Connections ? It is not acceptable that "since because RMI is evolving it is better than Socket methodology "
0
 

Author Comment

by:SBK
ID: 1223822
Prolonged silence from Mr.Hleungta. Why?
Please suggest some sites where I can get info regarding my question ?
Thanks in advance
0
 
LVL 4

Accepted Solution

by:
russgold earned 100 total points
ID: 1223823
The chief advantage of RMI is that it is simple.  Since you are already presumably using object calls to make pieces of your system interact, RMI allows you to extend this across a network.  With sockets, you must explicitly transform invocations into messages and then interpret them on the other end. RMI does that for you.

Another very nice feature of RMI is the ability to pass objects by value. That is, you can pass an object reference to an object on another machine and have the remote object call your local object *even if the local object is a subclass which is not known to the remote object!*  Try doing that with sockets.

In general, RMI will be the preferred way to go for basic Java-to-Java distribution.

Now, if you cannot depend on the remote objects being Java, RMI will not work for you.  At that point, you might want to consider CORBA if you will be doing a lot of such work, or bite the bullet and use sockets if the server interaction is minimal.
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
starter POM and spring-boot-starter,  spring-boot-web 2 43
table example 4 23
MySqlDump not dumping triggers 1 17
type mismatch (Object[] to double[] 4 0
INTRODUCTION Working with files is a moderately common task in Java.  For most projects hard coding the file names, using parameters in configuration files, or using command-line arguments is sufficient.   However, when your application has vi…
By the end of 1980s, object oriented programming using languages like C++, Simula69 and ObjectPascal gained momentum. It looked like programmers finally found the perfect language. C++ successfully combined the object oriented principles of Simula w…
Viewers learn about the “while” loop and how to utilize it correctly in Java. Additionally, viewers begin exploring how to include conditional statements within a while loop and avoid an endless loop. Define While Loop: Basic Example: Explanatio…
This theoretical tutorial explains exceptions, reasons for exceptions, different categories of exception and exception hierarchy.

920 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now