Results 1 to 3 of 3
  1. #1
    Anoop is offline Member
    Join Date
    Mar 2010
    Rep Power

    Smile Multiple interactions with same socket

    hey frnds,
    m trying 2 create a messenger application which provides one to one chat like a chat room..... like by clicking at name of other client and start chatting and number of clients at same time.....

    So can anybody tell me how to manage the threads in such a way that chatting with multiple sockets with a single socket.....

    please reply as soon as possible.


  2. #2
    Zack's Avatar
    Zack is offline Senior Member
    Join Date
    Jun 2010
    Destiny Islands
    Rep Power


    A socket can only connect to one address at once. If you run a P2P chat (i.e. there is no server involved) then you need multiple sockets set up--one for each chat.

    If you have a server, you can set it up to run the multiple sockets to every connected client, then have the clients send their data through a single socket back to the server.

  3. #3
    DC200 is offline Member
    Join Date
    Dec 2008
    Rep Power


    Expanding on what Zack said, you'd send a string back to your server containing the names or IDs of the intended recipients along with the message itself. The server would then parse those names or IDs and forward the message to the other sockets accordingly.
    Last edited by DC200; 11-29-2010 at 06:54 PM.

Similar Threads

  1. Multiple Socket Ports Question
    By Ambergahill in forum New To Java
    Replies: 5
    Last Post: 11-10-2010, 02:20 AM
  2. Replies: 1
    Last Post: 07-02-2010, 01:18 PM
  3. One socket and multiple threads
    By DC200 in forum Networking
    Replies: 1
    Last Post: 12-30-2009, 06:32 AM
  4. append response to the request from Socket and write to another socket
    By in forum Networking
    Replies: 3
    Last Post: 04-17-2009, 07:02 PM
  5. How to log the users interactions with database in struts?
    By piterskiy in forum Web Frameworks
    Replies: 0
    Last Post: 07-28-2008, 09:49 PM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts