Overview
Features
Download
Documentation
Community
Add-Ons & Services

Passing data through TCPServer Threads in ChatServer App

Please post support and help requests here.
cosu2004
Posts: 14
Joined: 05 Jul 2012, 10:50

Passing data through TCPServer Threads in ChatServer App

Postby cosu2004 » 24 Jan 2013, 00:39

Hello guy,

I was wondering, which is the best way to pass data through threads created by the TCPServer class?
1. It is ok if I make a common inherited object for all threads and each one writes data in this object and then the object sends a Notification to other so they can read it?
2. Change the TCPServer class or use the ServerReactor framework in a multithreaded way?
3 . It is possible to use Events for this job?
4. Make my custom TCPServer class and here implement a way to keep track of the threads and know who is who?

I want to use this for a server-client Chat application in which I have groups, chat rooms... Each client has his own thread. Any ideas which is the correct way to communicate between threads?

Thank you. ;)

alex
Posts: 1212
Joined: 11 Jul 2006, 16:27
Location: United_States

Re: Passing data through TCPServer Threads in ChatServer App

Postby alex » 24 Jan 2013, 04:01

cosu2004 wrote:1. It is ok if I make a common inherited object for all threads and each one writes data in this object and then the object sends a Notification to other so they can read it?

You already have such object: NotificationCenter
cosu2004 wrote:2. Change the TCPServer class or use the ServerReactor framework in a multithreaded way?

You can do that, too. In 1.5.1, there is also ParallelSocketReactor.
cosu2004 wrote:3 . It is possible to use Events for this job?

Events don't work across thread boundaries. Use Notificatons instead, they do.
cosu2004 wrote:4. Make my custom TCPServer class and here implement a way to keep track of the threads and know who is who?

Well, if you feel inclined, you can do that, too.


Return to “Support”

Who is online

Users browsing this forum: No registered users and 1 guest

cron