Win a copy of Practical SVG this week in the HTML/CSS/JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

How to call client with the help of servlets

 
rajshkhr pandey
Ranch Hand
Posts: 35
  • Mark post as helpful
  • send pies
  • 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
 
William Brogden
Author and all-around good cowpoke
Rancher
Posts: 13078
6
  • Mark post as helpful
  • send pies
  • 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
  • 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.
 
Ulf Dittmer
Rancher
Posts: 42970
73
  • Mark post as helpful
  • send pies
  • 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.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!