[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 2544
  • Last Modified:

RMI vs Socket Connection

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
SBK
Asked:
SBK
  • 4
1 Solution
 
SBKAuthor Commented:
Edited text of question
0
 
SBKAuthor Commented:
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
 
hleungtaCommented:
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
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
SBKAuthor Commented:
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
 
SBKAuthor Commented:
Prolonged silence from Mr.Hleungta. Why?
Please suggest some sites where I can get info regarding my question ?
Thanks in advance
0
 
russgoldCommented:
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

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

  • 4
Tackle projects and never again get stuck behind a technical roadblock.
Join Now