Win a copy of Reactive Streams in Java: Concurrency with RxJava, Reactor, and Akka Streams this week in the Reactive Progamming forum!
  • 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Junilu Lacar
  • Jeanne Boyarsky
  • Bear Bibeault
Sheriffs:
  • Knute Snortum
  • Tim Cooke
  • Devaka Cooray
Saloon Keepers:
  • Ron McLeod
  • Stephan van Hulst
  • Tim Moores
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Ganesh Patekar

TCP/IP,socket connection

 
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,friends:
I have a question regarding to the swing and web application.
Senario:
The swing application is used to monitor some activities happened in web application. For example, when a user is login the web application, a signal is showed in swing application the a user has login the web application.

The way I am thinking to implement is as following:
Using event and event listenet---When a user login, an event is generated from the web application. The swing application listens to the event, and perform some actions to show the signal. in order to have swing application receive event generated from web application, I think a connection between swing application and web application(localhost) should be established.

My Question:
1. How can I establish the connection between swing application and web application(assume web application and swing application is in the same machine).
2. Is the event-event listener approach correct in the above senario?
I really appreciate all your help and suggestions.
Best regards,
Nancy
 
Ranch Hand
Posts: 3451
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Nancy,
Considering that both VMS are on the same machine (I am assuming that the web application is a servlet/JSP app) then I would suggest using RMI. The initial setup for both ends of the plumbing is a little more difficult than a pure socket solution, but once done then sending and receiving events is as simple as it is in a single VM.
Hope this helps,
Michael Morris
 
Ranch Hand
Posts: 583
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
RMI is the best bet.. have the same worked out in a listerner/observer pattern where the call back to the swing application is thru RMI.
Regds
Lupo
 
The knights of nee want a shrubbery. And a tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!