kiran
kiran

Reputation: 301

Chatting in Java?

I am a Java beginner. I googled for one week for the solution. Now I'm posting this question. I want to develop a chat application in Java.

  1. It is web based.
  2. It need to chat with users in my company, by fetching the user list from my user table.
  3. I don't want to chat with GTalk or Yahoo.

How can I achieve this? How can I check which users are online? How can I integrate this with my current website?

Upvotes: 1

Views: 1775

Answers (3)

msk
msk

Reputation: 1

You can use Java RMI too. Of course it won't require any Web Container. Using RMI and Multi threading you can come up with a fairly working Chat application.

Upvotes: 0

Jakob Alexander Eichler
Jakob Alexander Eichler

Reputation: 3056

You will need sockets to solve your Problem.

Look at at the ServerSocket class. http://download.oracle.com/javase/1.5.0/docs/api/java/net/ServerSocket.html

call await in a while true loop (maybe in a new thread). It returns a new Socket (client Socket)

Save those in a List

have fun with it. :)

Upvotes: 0

Rasika
Rasika

Reputation: 1998

I am surprised that you didn't find any Java chat server solutions after Googling. Just did a search for Java chat server and it returned 1.15million hits. The first of which was a list of open source Java chat server source codes.

Generally, writing server applications in Java is fairly easy, but if you are looking at a high volume chat application (>1000 users), I would recommend moving onto a different platform such as C++.

You will also need to provide some more information about your user list. Is it on a DB or AD etc.

Upvotes: 1

Related Questions