• 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

Chat Program in Java

 
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi
I have written a chat program in java which has a problem.
The scenario is thus we have a small ticker running which tells the user visiting the site ,who else has logged on to the site and who are all logged on to the chat.
Now there is a small problem that I have not been able to solve:- if the user does not logout and his net connection gets disconnected then how do I pass this message to other users ?
i am using applets on client side and my server is listening on a port.
I tried sending a message from client side after specific intervals of time but what happens is the netscape just dies off because of the load and IE does not refresh at all , when I tried to do it on server side my Server just hanged.
I dont know what do I do?
I am using DataInputStream,DataOutputStream and BufferredInputStream,BufferedOutputStream.
PLEASE HELP
Sweety
 
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
How about sending a ping to all active users?
Ok, you've already said that you tried to send a message from your server.
But how do you realise it? You have to catch the exception to handle the case in which there is noone there who can hear your server pinging.
Normally a ping a normal string of bytes. Here it is not necessary to use a very long string. To minimize the trafic I would only send the changes. If there is a new user you send his name, when a user has left you send his name twice. It is not very difficult to manage this data in the applet. A little parser can manage this. If you need a grammar for it, post me an e-mail. Cause I thought here are not enough users want to see BNF's.
I don't know how your chat works, but the comments of the users must be send too. And if that works, this ping should also work.
If not ask me twice and post the message of the vm shown after the server has crashed.
I hope it helps you.
j.a.n.s
 
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi
The methods read and write in BufferedInputStream will throw an exception when other end is disconnected, catch the exception, from there send message to other users.
hope it works for u
regards
Rajakumar.
 
Sweety Anthony
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks a lot . Rajakumar Makapur's suggestion was an excellent one and it worked perfectly well. I was wondering why it dint strike me before.
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic