Java RMI for implementing server side of system - java

I am developing system, that consists of client (written in JavaFX) and server. Now I am going to implement server. Users will download clients. Clients will communicate with server (only one server and many clients). Server will communicate with data base and send results. Server will support authentication and different requests (not http of course). Is it a good idea to implement server with Java RMI? If no, could you advice me any good idea about server realisation.
Thanks a lot for future questions!

RMI is bit kind of traditional but still powerful to me ,it has some draw back . But, despite the RMI there is also a chance for you to use java sockets class ? just like a client -server application ...

Related

Java Server and client/ RMI or Socket?

I'm developing a Desktop LAN base java server and client application
where a Client must login and also to pass some data to server.
assuming i have 10 clients that inserting record simultaneously to server.
which is the best approach in this kind of situation, should I use RMI for login and record insertion? or Sockets?
if sockets please provide a key idea for me to start with.
key points to consider
-Multithreading
-able to send back data on client
If you want to connect your server via internet (and/or firewalls) it is probably a hassle to do this with plain RMI. In the past I have used Java Simon for such tasks which is very easy to implement. However if you plan to support other clients than Java clients, then you should have a look at Apache Thrift or Google Protocoll Buffers

difference between network mode and non-network mode

I am having difficulties understanding the difference between network mode and non-network mode terms as used when dealing with client server applications in java.
I know how to develop simple client server apps. For example I can create a client application and server application. These applications can connect to through sockets and send and receive data. I however get confused when people talk about running a server and client in standalone mode, where both the client and server use the same instance of a JVM without loop back networking involved. I have seen this happening with the java derby database.
So my main question is how do you take code that was using sockets to communicate and convert it to use the so called "standalone mode" where the client and server run as one application? I will appreciate any comments that point me to the right material.
In the so-called network mode you have to connect to a remote server, as you describe, typically through a socket and so your client asks the server to do certain task, the server carries out the task and responds to the client.
In this mode, it is customary that the client and the server will be different nodes, that is different machines, running independently.
But what if you wanted to run you client and your server in the same machine? Even in the same virtual machine? Would it make sense to go through a socket to ask your server to do something?
That would be like using Skype to chat with a friend sat right by your side, to simply ask him to go have lunch.
So, ideally, in these cases, you should be able to run your application in non-network mode. That is, instead of going through a socket, you access your sever object directly and ask it to do something for you. Since your server object is located in the same virtual machine as your client.
Evidently, for you to be able to do this, you need a good design that exposes your server functionality through an interface, and your application uses this interface to interact with the server. When you are running in network mode, you use an implementation of this server interface that uses a socket (or RMI or whatever you do for network communication). When you are in non-network mode, you get an implementation of the server object itself.

cross language api for this client server communication model

my question is following up from this question:
Simple Protocol Concept in Java for this setup
The idea is exactly the same i.e client will send request and server respond with some information:
However i want a well known protocol implemtation such that the server/client can be implemented in any programming langguage. So that client Running java can communicate over TCP/IP sockets to remote app written in C e.g.
for this reason, can you recommend any well known opensource implementation?
Just few tips:
Rest interface: http://en.wikipedia.org/wiki/Representational_state_transfer
Corba: http://en.wikipedia.org/wiki/Common_Object_Request_Broker_Architecture
Apache Thrift: http://thrift.apache.org/
Google Protocol Buffers: https://developers.google.com/protocol-buffers/
your own implementation over tcp...
it depend on your architecture and your requirement, you can use TCP protocol directly, Http is another choice, if your server deployed on a http server, i recommend using web service. i hope my answer will give you some ideas.

Client server application - Best approach in Java

Need to create a client server application, both have to communicate with Database. Which approach suitable for this,RMI, Socket programming etc....
If server communicates with database, I think that client should not (according to layers/tier ideology: http://en.wikipedia.org/wiki/Multitier_architecture).
Or if your client works directly with database, than you could avoid usage of server.
For client-server communications you could use a lot of options: RMI, sockets, webservices, etc.
If you have an experience with java web applications, I suggest to use webservices, if not - RMI.
When I took my 1st module about client server application in my University, they taught me about RMI & Socket programming. In my opinion, if you want to have basic knowledge about client-server communication, RMI & Socket programming should be useful. However, if you need a solution that you will bring into production system, you should take a look at EJB with JSP/JSF.

Proxy Server in java

I am new to java.I need to develop a proxy server for IBC 2011 conference.I have some Questions regrading the Proxy server.
1.I am going to develop the proxy server using java.
Suppose A(sending the information) to B(receive the message) through the proxy server.
Here A is sending the information through HTTP serves(application running in A is a wed application) how can i receive the information send by A in proxy server and how can I forward it to the B which is also a HTTP serves.
2.What r the Things I have to now before I start developing the proxy server.
3.How can i get the information from the HTTP protocol.
4.How can i check frequently for the any message is there in line to forward to B from A or B to A.
Can any one helpme.Thanks in advance.
Use one of these instead http://proxies.xhaus.com/java/. Rolling your own proxy implementation will be much harder than you think once you've taken all the intricacies of HTTP into account.
there are many libraries which can you use.
for the A and B they can running hessian server(for listening) + client(for sending)
and for the proxy server you can use JMS + hessian server + client same as for A and B.
In this way you can send java objects.
But hessian is only on suggestion you can use RMI or spring remoting or maybe web services.
By far which a have working hessian is the fastest and very easy to develop.
from 1 to 4 you ask how to design a application which is out of the scope and you need to do it by you self :).
I did something similar in my course project.
As far as i am concerned, the core knowledge u need to learn about java for this a proxy server is socket programming.
you can setup two sockets: one communicates between your proxy server and the web browser, the other communicates between your proxy server and the target server.
Also, you will need some knowledge about thread in Java, open one thread for each connection will be a efficient way.
And I assume that you already have the knowledge about those computer networking stuffs like http, tcp.etc.

Categories

Resources