wood burning stoves 2.0*
The moose likes Beginning Java and the fly likes chat room, where should i start? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Java » Beginning Java
Bookmark "chat room, where should i start?" Watch "chat room, where should i start?" New topic
Author

chat room, where should i start?

Anonymous
Ranch Hand

Joined: Nov 22, 2008
Posts: 18944
i am writing a chat room on an intranet site.
there are should be a main text window, an 'entry' text field
and a window to display all user, perhaps something else.
I am mostly intrested in a mechanism ( servlets or applets, and how to build send-recieve system.
any suggestions are appreciated.
artur
Val Dra
Ranch Hand

Joined: Jan 26, 2001
Posts: 439
hi i have builded a chat system using servlets it works out prety well , if you'd like i can send you the files for it. One drawback is that it requires a serversocket so i can't show you an example because non public servers allow you to open serversocket on their servers. Let me know.


Val SCJP <BR>going for SCJD
Cindy Glass
"The Hood"
Sheriff

Joined: Sep 29, 2000
Posts: 8521
Hey Val, would you consider just giving us a summary of how it works - so that we get the gist. Just for educational purposes of course .


"JavaRanch, where the deer and the Certified play" - David O'Meara
Val Dra
Ranch Hand

Joined: Jan 26, 2001
Posts: 439
Hi , i can try to explain but i am not good at explaining certain things.
I am not an expert in java or servlets but this is how i implemented this chat to get it to work.
I had 3 frames on html page. One called Chat servlet which generates dynamic html on the fly. 2nd one was a user list also dynamicly shows all the users which come and go from the chat and 3rd one was the Footer servlet. Now Chat servlet is responsive for reading messages send by other users and just formatting the messages simple nothing more. User servlet just reads users from a collection which are connected to the server and display their names . It also has ignore / and private message set up so that you can send or ignore(controled by clicking a checkbox on html) this is done though the javascript part. When this happends the user who was just ignored recieves the notification that he no longer can send messages to the other person. Private message works by clicking on the user name(link) which places user name into a textfield on html and when you send a message the messege will be delivered only to this person with indication from whom it was.
Last part is the Footer which is actually just sending messages to all the clients or privately. How i did it was simple. I had a server class which listens on certain port. When user first connected though Signin page he gets a socket. Now Server class is responsible for sending the messages to all the clients and etc. Sorry don't know how clear i explained it if something is not clear let me know i'll try to explain it better
Cindy Glass
"The Hood"
Sheriff

Joined: Sep 29, 2000
Posts: 8521
I think that I got it!! Thanks!
 
GeeCON Prague 2014
 
subject: chat room, where should i start?