Thread Communication Help

Client/Server Messenger Program

Page 1 of 1

3 Replies - 2995 Views - Last Post: 17 April 2007 - 07:27 AM Rate Topic: -----

#1 nasha  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 3
  • Joined: 15-April 07

Thread Communication Help

Posted 15 April 2007 - 12:58 AM

Hi Guys,
Just wondering if anyone would be able to shed some light on my current problem. Ive written a multi client server for a school assignment that implements threads for each new connection. Each client currently has two way communication with the server, but im unsure on how to expand it so it can become more like an online chat environment. Ive attached the source, and any help or suggestions would be MUCH appreciated.

Regards in advance,
Nash

Attached File(s)



Is This A Good Question/Topic? 0
  • +

Replies To: Thread Communication Help

#2 Programmist  Icon User is offline

  • CTO
  • member icon

Reputation: 252
  • View blog
  • Posts: 1,833
  • Joined: 02-January 06

Re: Thread Communication Help

Posted 16 April 2007 - 07:24 AM

I want you to get help, but unfortunately, I don't have time to look through your code right now (and probably won't for several days). Might I suggest giving a more detailed description of how your program works now vs. how you want it to work? Saying you want it to work more "like a chat program" is not specific enough. What functionalities of a chat program do you want it to emulate? How does it function now?
Was This Post Helpful? 0
  • +
  • -

#3 nasha  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 3
  • Joined: 15-April 07

Re: Thread Communication Help

Posted 17 April 2007 - 07:08 AM

I probably shouldve done the from the start. At present clients connect to a server. The client can send messages to the server, and the server echos that message back. This is true for all connected clients. What i wish to do, is make it so that when clientA sends a message, all connected clients recieve that message.
Was This Post Helpful? 0
  • +
  • -

#4 Programmist  Icon User is offline

  • CTO
  • member icon

Reputation: 252
  • View blog
  • Posts: 1,833
  • Joined: 02-January 06

Re: Thread Communication Help

Posted 17 April 2007 - 07:27 AM

The way I would design something like that is to have a message queue on the server where all messages from all clients are sent. The clients would be connected to this queue by an event system. For instance, if client B sends a message to the server, the server adds it to the queue and then fires some event that lets the clients (which are listeners for this event) know that a new message is on the queue and to retrieve it via some method. Once all connected clients have accessed a particular message it could be de-queued or something. Just an idea.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1