Suppose you are a software developer at tele Sales.Inc whose business is to promote sales of other firms and get commission on this behalf. Recently your company has contracted with Teralink for its products sale. Teralink is Telecom Company which is introducing new modems. Both the companies are one building a part. Your boss wants to have a private and secure interaction with Teralink’s Director therefore he demands you to develop software by which he can send messages, daily information of stock prices and sales in the form of sales objects and files of monthly sales. Luckily Teralink is also using java based applications .As Teralink is newly established so initially it is using (UTP) Cable CAT-3 for LAN connections. As the business is in progress your boss has given you enough time for this project.
Considering this situation in your mind which one of the following technologies you will use to develop interaction among these companies either sockets or RMI? Support your choice with suitable reasons.
It actually depends upon the situation and what are your requirements.But according to my point of view, RMI is light weight and has method invocation on end point. If our client will use java then RMI is best and simple but if our client has idea to change the plateform from java to any other then sockets are best.RMI is simple and code is reduced and easy to implement. It is a standared protocol and use object orientation. In the given scenario RMI is more suitable. RMI would limit the client to be another Java application. In case you don’t know, RMI is a Java only version of CORBA.
Socket programming – you have to handle exactly which sockets are being used, you specify TCP or UDP, you handle all the formatting of messages travelling between client and server. However, if you have an existing program that talks over sockets that you want to interface to, it doesn’t matter what language it’s written in, as long as message formats match.
RMI – hides much of the network specific code, you don’t have to worry about specific ports used (but you can if you want), RMI handles the formatting of messages between client and server. However, this option is really only for communication between Java programs. (You *could* interface Java RMI programs with programs written in other languages, but there are probably easier ways to go about it
One benefit would be that RMI works in terms of objects and method calls, whereas socket communication works on the level of bytes sent and received (leaving aside serializing of Java objects for the moment). So socket-based apps need to put some infrastucture in place to get to the level where RMI is at.DOWNLOAD SOLUTION HERE