Java: sockets or RMI?

I need to separate our application from the lightweight gui application and the business logic application. This will not configure the client / server as such, since the server component will have only one client.

Another limitation in the application is that it has only one entry / exit point. Therefore, if we use RMI, it will only ever be on one function. All these forms are already wrapped in a string and pass through one transport zone.

Should I just use Java Sockets to improve this application or use RMI? Or some other Java technology?

I made a previous post outlining the requirements of our application, but it remained unanswered. https://stackoverflow.com/questions/2604528/terminal-panel-pc-single-server-solution-client-server-or-rdp

Greetings.

+7
java client-server sockets rmi
source share
4 answers

personally, RMI seems a bit overkill if you only have one method to call and all your data is already wrapped in a string. I assume a simple socket server will be good enough for your needs. however, RMI does give you a bunch of things for free, for example, multithreading, distributed garbage collection, sorting objects, etc., however, if you have only one client, then multithreading may not be practical, and since you do your own marshalling of objects, then these benefits may not bring you anything.

there is a good page about rmi features: http://java.sun.com/javase/technologies/core/basic/rmi/whitepaper/index.jsp

+6
source share

since your protocol is already very simple (you just pass the string) I suggest you just go with sockets. the advantage is that you will not be tied to Java at both ends, for example, - you can easily switch the user interface to another language.

+2
source share

Having done applications that used raw sockets for communications that used RMI and that used SOAP, it’s easiest (with thin hair) to use RMI, but then you are completely required to use Java for everything. The key to why RMI is easiest is that it provides all messages and includes a basic detection infrastructure, but it does not have SOAP complexity (which is much more complicated than all of the above).

+2
source share

You might consider moving the entry point to the server as a servlet and doing POST from the client.

+1
source share

All Articles