June 2nd, 1999, 12:39 PM
Hello!
Platform details ---> VC5, NT4, SP3
I have a client VC app connected to server app, who has child threads that send data to this cleint app on a connected socket (CSocket), simultaneously. Now if this connected client CSocket has an OnReceive() handler for when receiving new data on the socket from any of the server's child threads, and it in turn, creates a thread to handle the incoming data in OnReceive(), so that I don't have the situation of the handler being too long and then I might be loosing data as it's coming from the server's threads. This way the client's threads quickly handle the data as it comes from the server's threads. BUT what happens when data written from Server Thread_A is interrupted by data send from Server Thread_B and so on!? Can this happen? Does this mean the data will be inconsistent? Will it be over-ridden by data sent from a second thread to the same socket? Can the data be queued or blocked to ensure some consistency? Or what would you have done?
If you are wondering, The Server App (well actually it's "child" threads), have to send data (update values) to the connected client's socket. I could synchronize these threads when they send the data, but that's my last resort. And it's something I'll rather not do, since I don't want to hang-up the Server too much.
Any ideas? tips? samples?
Thanx in advance.
Platform details ---> VC5, NT4, SP3
I have a client VC app connected to server app, who has child threads that send data to this cleint app on a connected socket (CSocket), simultaneously. Now if this connected client CSocket has an OnReceive() handler for when receiving new data on the socket from any of the server's child threads, and it in turn, creates a thread to handle the incoming data in OnReceive(), so that I don't have the situation of the handler being too long and then I might be loosing data as it's coming from the server's threads. This way the client's threads quickly handle the data as it comes from the server's threads. BUT what happens when data written from Server Thread_A is interrupted by data send from Server Thread_B and so on!? Can this happen? Does this mean the data will be inconsistent? Will it be over-ridden by data sent from a second thread to the same socket? Can the data be queued or blocked to ensure some consistency? Or what would you have done?
If you are wondering, The Server App (well actually it's "child" threads), have to send data (update values) to the connected client's socket. I could synchronize these threads when they send the data, but that's my last resort. And it's something I'll rather not do, since I don't want to hang-up the Server too much.
Any ideas? tips? samples?
Thanx in advance.