Chat application


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 3 of 3

Thread: Chat application

  1. #1
    Join Date
    Jun 2005
    Posts
    2

    Chat application

    Hi ,
    I need to create a chat Application using j2ee and web services.
    can anyone help me out as to how to go about it.
    I would be of great help if i receive some valuable suggestions from anyone.
    Thanks a lot
    al

  2. #2
    Join Date
    Jul 2005
    Posts
    22
    Having never used j2ee, I would not know what to suggest, but I do know that I have successfully made a p2p chat program using j2se. Here are the basic classes and discriptions that went with my program:

    Server:
    created a server socket and was set up to recieve connections and send it on to a ServerThread to process additional input.

    ServerThread:
    thread for recieving and processing information from a client

    Client:
    connected to the server, sent text messages, recieved messages and processed them.

    Message:
    Very basic interface simpley extending Serializeable and having no methods

    TextMessage:
    implements message and holds a string of text to be displayed on every other connected client.

    Although this is the core bones of my program, you should be able to start from there. The main classes that I used for connections are as follows:
    import java.net.Socket;
    import java.net.InetAddress;
    import java.net.ServerSocket;
    import java.io.ObjectInputStream;
    import java.io.ObjectOutputStream;

    from this, you should be able to reference the javadocs to learn how to program everything you want.

    P.S. As I said, this is from my p2p chat program using j2se 1.4. I do not know if there is a different way to do this via web and j2ee, but this should at least give you a good start.

  3. #3
    Join Date
    Oct 2004
    Posts
    311
    There are a few ways to go about settingup a chat application.
    You can use the approach stated above, You can setup a web based servlet, or you can use RMI.
    The latter 2 options are J2EE.
    The servlet aproach means you build a servlet, which then runs on a J2EE enabled web server. The chat application can connect to this servlet to exchange information.
    The RMI variant is slightly different in the way that it lets you perform straight method calls on remote objects. You would program the RMI classes and register them with the RMI registry. The application would then request a handle to the RMI class from the RMI registry, after which you can make method calls on the RMI class. These method calls can be blocking calls, so it is easy to see how you can use this for getting chat info from server to client.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center