Solved

RMI vs Socket Connection

Posted on 1997-07-25
6
2,318 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
The Ultimate Checklist to Optimize Your Website

Websites are getting bigger and complicated by the day. Video, images, custom fonts are all great for showcasing your product/service. But the price to pay in terms of reduced page load times and ultimately, decreased sales, can lead to some difficult decisions about what to cut.

 

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

Transaction Monitoring Vs. Real User Monitoring

Synthetic Transaction Monitoring Vs. Real User Monitoring: When To Use Each Approach? In this article, we will discuss two major monitoring approaches: Synthetic Transaction and Real User Monitoring.

Question has a verified solution.

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

Java contains several comparison operators (e.g., <, <=, >, >=, ==, !=) that allow you to compare primitive values. However, these operators cannot be used to compare the contents of objects. Interface Comparable is used to allow objects of a cl…
Introduction This article is the second of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers the basic installation and configuration of the test automation tools used by…
Viewers will learn about arithmetic and Boolean expressions in Java and the logical operators used to create Boolean expressions. We will cover the symbols used for arithmetic expressions and define each logical operator and how to use them in Boole…
Viewers will learn about the regular for loop in Java and how to use it. Definition: Break the for loop down into 3 parts: Syntax when using for loops: Example using a for loop:

691 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