How to invoke client method without using RMI - java

i am developing a client/server program in which i want to invoke a method of client program
through server program.
this is vnc based application in which the server will be running and listening to any arbitrary port number .... the client will connect to the server using a method which has argument in the form of ip and port number of server.
after that the server will be able to take control of the client's screen.
i want to call this method from server !!
i want to add a facility in which the client will submit a request and server will then connect to the client ..
i have heard about RMI but i want to know is there any other way available to achieve this if not pls post some good tutorial links on RMI .

RMI is a Java-only way for network programming or method calling but Web Service is language-independent. By web service you can integrate some application.
But my recommendation is using MOM systems. This type of system support two approach : Synchronous Model and 'Asynchronous Model'. In Java MOM is implemented via JMS.(look in here). JMS is an API and have several implementation such as :
Apache ActiveMQ
Open JMS Queue and etc

better than RMI, you could make a web service and a client for it :)
http://www.artima.com/lejava/articles/threeminutes.html

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

Can I invoke a client´s method from a server with RMI

I would like to know if with RMI a server can remotely invoke a method from any of his clients, or just the clients can do this with their server.
Regardless of any implications of such a design decision, it is possible to use RMI between two JVMs that are accessible through the network. This means that if the server can access its clients through the network, and the clients have a JVM available and can act as RMI servers, then it is possible to make a client or each of the clients an RMI server and have the "server" communicate with each one of them.
Assuming the server is an application server i advise you to use the Java Messaging Service (JMS) to allow the server communicate with the client systems.
Yes, firewalls permitting. The client has to export its callbacks as remote objects and supply them to the server, typically via some registerCallback() API. Then the server just calls the methods.
However firewalls to the Internet typically don't permit callbacks, and if they do there may be issues with port numbers: you will probably need the clients to export their remote objects on a specific port which is opened in the firewall, typically 1099.
Besides the solution provided by melc, it is also possible to achieve a full duplex communication between the client and server by using WebSockets. They are now part of the Java EE 7 specification, you can read something more about them here: http://docs.oracle.com/javaee/7/tutorial/doc/websocket.htm. There are also other solutions, like Comet, or JMS (which is used like webosckets in RichFaces).

Java RMI for implementing server side of system

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 ...

Client Server Apps+java

I have a java requirment contains both client and server side program.
Server side
Server program frequently check the data base and checks if a new order came, if order came it check the order and send it to the corresponding client machine using IP address and port.The client machines are out side the LAV and has static IP address.
Client side
Client program listen a its on port , when an order came, read it and process.
For implementing these app, which java package is best,java socket communication or any other.Anybody know please suggest one.
Help is highly appreciated,
Thanks,
vks.
Don't go for low level programming like Sockets etc. Use RMI. Your program will have following two entities
Server side :
An RMI Client for calling client machine to send update after checking the database
Client side :
An RMI server application listening for Server update requests and do processing.
If you are new to RMI check out this tutorial . You can search for better tutorials if don't find these good enough :).
I remember I had to do something similar in the university and I used JMS (Java Messaging Service), documented here:
http://www.oracle.com/technetwork/java/jms/index.html
The Server will create the messages from the DB by checking it periodically and will send messages to the clients which will process the info.

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