Distributed application on Java client server

I need to create a distributed application composed of one server (developed in Java) and one or more remote GUI clients (Swing application with windows).

As stated above, clients are a Swing GUI application that can connect to a server to receive and send data. Communication is bi-directional (Server <=> Clients). The data sent over the network mainly consists of my domain logic objects.

Two quick examples: the client calls the server to receive data to fill the table inside the window; the server calls the client to send data to update a specific widget (like a button).

The amount of data transferred between the server and clients and the frequency of network calls are not particularly high.

What technology do you suggest me for communication between servers and clients?

I mean one technology that suits me, but I would like to know your opinion.

Many thanks.

+2


source to share


5 answers


The first technology that came to my mind was RMI - fine if you are communicating between java client and java server. But you can run into difficulties if you want to switch the client technology to, say, a web interface.



+5


source


I would go with RMI, but implement the whole architecture using the Spring framework. Thus, it is independent of the technology used and can be switched to other communication methods (eg HTTP or others) without encoding.



UPDATE: And Spring will let you have no specific RMI code.

+2


source


I believe sockets should do the trick. They are flexible and not particularly hard to code / maintain. Most entry-level programmers should also be able to support them. They also adapt quickly to any environment.

Unless your server gets removed or you are expecting firewall issues. In this case, web services are the way to go since your main communication is over port 80.

0


source


I would prefer the second RMI proposal, except that I was just using EJB3 (which uses RMI as my communication protocol). EJB3 is very simple and even if you don't use other features that EJB gives you (like security), you can still use container managed transactions (CMT). This really makes the development process easier.

As for the server-> client communication, you probably want to use JMS. Again, using EJB3 this is quite difficult to do with annotations. Clients will subscribe to the messaging service and receive update notifications from the server.

And yes, I am currently working on an application that does exactly that. Unfortunately we are using EJB2.1. However, I believe this is where EJBs really shine. Using EJBs in a web application is often overkill, but in a distributed client / server application, they work very well.

0


source


You can try using ICE http://www.zeroc.com to establish a client-server connection.

0


source







All Articles