• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Implementing a message broadcast server using servlets

 
Sanjth Joseph
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello all, I wanted to write a servlet that:

Receives string messages on doPost method-Once received, this message should be broadcast to all other clients.

I did this by having the client periodically refresh itself(meta http-equviv=refresh) and receive the new messages.. Is there a better way?? One in which the client could issue something like a blocking GET request
. Iv tried this with sockets but have no clue to go abt it using http.. tanx
 
ramakrishna rayudu
Ranch Hand
Posts: 57
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Pleas give me more information abt this...
if you want use servlet for this purpose the client should all ways send http request only and in your client implementation may be browser or any other app.
if you are writing any Socket Programe then Http Client will not work(Browser) then allways it should be the Clent App.(Socket Client)
and an other good Option is if you want this in browser in Flex/Flash can this purpose with Socket Server.
 
Sanjth Joseph
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
On client side I wanted to use an applet that speaks http to the server via HttpURLConnection class. On the server side, i wanted to use a servlet... The client(applet) first logs in with a user name.
Once logged in, the client should be able to send a msg to server(via post method ). It also has a text area to receive text messages sent to the server from other clients. This is where I have a problem-
How does the client know when to ask server if any new messages have been received. The client could poll the server, but I wanted a more asynchronous method where the server could alert clients that a new message has been received...
 
ramakrishna rayudu
Ranch Hand
Posts: 57
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
yes..this is what i want.
if it is http request for every request there is response means until you send request you dont get any response.
so
1)one thing all ways you need to poll the server for getting the incoming messages..
2)second thing (good one) possible with Flash/Flex i think second is very good option.(****Servlet will not work in this role******)

this is the problem we had in lost 10 months in one our project called [u]http://www.cherple.com/widget.asp
see this onces. this is two way chat application pc-cellphone when the mobile
user replays any message then Automatically it will come to the Client Side Flash widget (it will run in the browser).[/b]
i think i told the correct answer.
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64833
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
ramakrishna rayudu wrote:Pleas give me more information abt this...

Please use real words when posting to the forums. Abbreviations such as "abt" in place of "about" only serve to make your posts more difficult to read and less likely to generate useful responses.

Please click this link ⇒ UseRealWords for more information.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic