I have a server that accepts different clients. Every client is handled in a different thread. The clients should be able to send messages between them, therefore they need to be able to access a specific thread
I have a server that accepts different clients. Every client is handled in a different thread. The clients should be able to send messages between them, therefore they need to be able to access a specific thread
Aside from the obvious question of why you need separate threads to handle client connections, why does one client handler need to know about another client handler's thread?
Cheers,
_
As I mentioned above it is one of the solutions I came up, but I am open for suggestions if there is a better way to do it.
Nevertheless I will have to access a specific thread/Client from the server then to be able to forward the received message from one client, or not??
How else would I send the messages between the clients?
Unless you expect complex and CPU intensive tasks on each client handler, you could simply handle them with the same thread.
You write "thread/Client" but those two things are not the same.
So far you have only provided indication that you need to access client handlers, but there is nothing suggesting you need access to a client handler's thread.
Same as in a single threaded application:
- method call
- signal/slot connection
- sending an event
None of which require access to any specific thread.
Cheers,
_
Bookmarks