• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Sending data from Web Application to a Desktop Java Application

 
Ranch Hand
Posts: 117
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hello javaranchers,

I have a Web application and a Desktop java application running on two different systems. My requirement is as follows :

The Web application need to establish a communication with the desktop java application and send some data to it. I am not quite sure which technology to use to carry out the above process.

Could anyone please share their thoughts on the technology/process that could be used to do this.
Thanks in advance.

Regards,
Hardik
SCJP
 
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Sockets are probably the easiest way. But the all-important question is: how does the web app know on which IP address the desktop app runs?
 
Sheriff
Posts: 13411
Firefox Browser VI Editor Redhat
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Another thought would be to write a desktop app hat polls the servlet app every n minutes or seconds. If it only need to check hourly or daily, you could use a cron job or a Windows Scheduler job to invoke the Java app, rather than have it run as a service.
 
Hardik Raja
Ranch Hand
Posts: 117
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Another thought would be to write a desktop app that polls the servlet app every n minutes or seconds.



Could you explain in bit detail how can a desktop app poll servlet app ?
 
Hardik Raja
Ranch Hand
Posts: 117
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Sockets are probably the easiest way. But the all-important question is: how does the web app know on which IP address the desktop app runs?



Ya thats true, I was also wondering how to accomplish this ? Any other idea ?

Below are my thoughts on your comment, please correct me if I am wrong

Socket programming helps us achive client - server communication in which server would be waiting for clients to connect to them and communicate with them.

But here I require peer - peer communication (Web application to java desktop application) in which web application upon recieving some data would be creating connection and sending that data to java dektop application.

Thanks
Hardik
 
Bartender
Posts: 9626
16
Mac OS X Linux Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Could you explain in bit detail how can a desktop app poll servlet app ?


You simply make a request to the servlet at a certain interval. Are you unfamiliar with timers in Java or how to talk to a servlet?

Socket programming helps us achive client - server. . .
But here I require peer - peer communication



You are drawing a distinction where none exists. It is not uncommon to have network peers communicate using sockets. Contacting a servlet via URL uses sockets. The difference between the two is the protocol.
You need to take a look at your requirements. Does your desktop app need instant updates from the web app? Polling will not do. Updates every few minutes? Polling may make sense. If you need the web app to send instant updates, as Ulf indicated, your web app will need to know how to contact it. It can do so directly (the desktop app listens on a socket and the web app contacts it via custom protocol) or you use some intermediary like Java Message Service to handle the details of transmission.
 
Hardik Raja
Ranch Hand
Posts: 117
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Dear Joe,

Many thanks for your reply.

Are you unfamiliar with timers in Java or how to talk to a servlet?



Could you please give some brief idea about this ?

Kind regards,
Hardik Raja
 
First, you drop a couch from the plane, THEN you surf it. Here, take this tiny ad with you:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic