• 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:
  • Liutauras Vilda
  • Campbell Ritchie
  • Tim Cooke
  • Bear Bibeault
  • Devaka Cooray
Sheriffs:
  • Jeanne Boyarsky
  • Knute Snortum
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Ganesh Patekar
  • Stephan van Hulst
  • Pete Letkeman
  • Carey Brown
Bartenders:
  • Tim Holloway
  • Ron McLeod
  • Vijitha Kumara

Implementing a message broadcast server using servlets  RSS feed

 
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
 
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.
 
Author and ninkuma
Marshal
Posts: 66806
168
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.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!