• 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

How to call client with the help of servlets

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

I am trying to develop a client-server application in which client is using swing as it user interface and on server side, Tomcat server as server.
Now I can send the strings to the server using http, and server replies correctly. i.e. a string is sent to the server and it returns me reverse of that string.
Now when two or more users are logged in and one user submits a string it should broadcast to other users with answer.
I cannot understand from where to start.
How to manage the session of different users that are logged in and how server initiates the call to the client?

Please suggest me what to do.
Thanks in advance
 
Author and all-around good cowpoke
Posts: 13078
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
This question belongs in the servlet forum.

The HTTP protocol expects all client interaction to begin with a request from the client, the server side is not expected to initiate an interaction. Needless to say this has inhibited attempts to do what you want, but there are solutions.

In AJAX style, the client frequently checks for updates using JavaScript every second or so - a check for new data can be very fast.

There is also COMET (they just had to name it that way, sigh) which puts the server in charge. Do a search for "java servlet comet" to find lots of references.

Bill

 
rajshkhr pandey
Ranch Hand
Posts: 35
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks for your reply.

I want to make a chatting application using swing as user interface and Tomcat server serving the request of the users.
I had done this by using RMI but I am facing problem of firewall blocking my server call back.
So please suggest me how do I start with webservice for the this application.

Thanks in advance.
 
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Web services operate on top of HTTP, the same protocol used by servlets, so the constraints are similar. But web services are actually less useful than either of the approaches William mentioned, so you should pursue those.
 
reply
    Bookmark Topic Watch Topic
  • New Topic