• 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 ...
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
  • Mikalai Zaikin

chat program??

Posts: 19
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
i am wondering which would be best to make chat program.
i know it can be made through java.net package, java.rmi package and javax.servlet package.
kindly tell me which would be best and reason me if possible.
thank you,
nima lama.
Ranch Hand
Posts: 54
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi nima,
In my opinion, the EASIEST way to do it is to use java.net + java.io package. And I don't see where servlets can help here.
If I were you, I would create a server that identifies at each moment who are the users that are connected (IP + nickname), and I would create a client app that interacts with the chater.
This client application would itsself contain a server part, and a client part. The server part will be a separate thread that is listening for other chaters to connect to this client app. So it would basically a ServerSocket with a well known port. And the client part of the client app, would be a Socket that connects to other chaters.
And at each moment, the client app is aware of the presence of all connected users thanks to the server application.
Now you will just need java.io.ObjectInputStream.writeObject("hello there"), to send data, and (String)java.io.ObjectInputStream.readObject() to get data. The ObjectIn/OutputStreams, you will get them from the Socket.getIN/OutputStream().
I can't take it! You are too smart for me! Here is the tiny ad:
a bit of art, as a gift, the permaculture playing cards
    Bookmark Topic Watch Topic
  • New Topic