gambiting
December 30th, 2007, 04:16 PM
Hi! I'm programming my own IM,using QT and linux Socket libriary ( http://www.alhem.net/Sockets/ ).As for now I have achieved:
-Working QT app,with one thread that runs window,and other one for network
-Echo server - it receives message from qt app and echoes it back.It also spawns new thread for each new connection.
My problem is,that I want to send message to all connected clients simultaniously - it looks like that:
I run my server program.Client number one connects.Client number two connects. Now I want to send client two message that client one send to server.I don't know how to do it as every connection's thread is set to listening - it activates only when it receives data(and echoes it back,then goes to listening again),so when I receive message in thread number one,I don't know how to send it to thread number two.Could anyone explain it to me?Is listening to incoming and outgoing connections possible?If yes then how?If not how can I do what I described?Thanks
-Working QT app,with one thread that runs window,and other one for network
-Echo server - it receives message from qt app and echoes it back.It also spawns new thread for each new connection.
My problem is,that I want to send message to all connected clients simultaniously - it looks like that:
I run my server program.Client number one connects.Client number two connects. Now I want to send client two message that client one send to server.I don't know how to do it as every connection's thread is set to listening - it activates only when it receives data(and echoes it back,then goes to listening again),so when I receive message in thread number one,I don't know how to send it to thread number two.Could anyone explain it to me?Is listening to incoming and outgoing connections possible?If yes then how?If not how can I do what I described?Thanks