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

    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.

    Thanx

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

    Default

    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
    Posts
    49
    Rep Power
    0

    Default

    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 07:54 PM.

Similar Threads

  1. Multiple Socket Ports Question
    By Ambergahill in forum New To Java
    Replies: 5
    Last Post: 11-10-2010, 03:20 AM
  2. Replies: 1
    Last Post: 07-02-2010, 02:18 PM
  3. One socket and multiple threads
    By DC200 in forum Networking
    Replies: 1
    Last Post: 12-30-2009, 07:32 AM
  4. append response to the request from Socket and write to another socket
    By vaibhav_singh_vs@yahoo.co in forum Networking
    Replies: 3
    Last Post: 04-17-2009, 08: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, 10: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
  •