Hello Éric, > FSocket is a pointer to socket passed to the thread´s constructor
Execute method is ok. Dont forget to ThreadDetach before giving the socket to the thread. Aslo be aware that between the Detach/Attach there is no window assigned and the socket will not be notified of data. It is only a fraction of time of course. > OnDataAvailable event will be triggered by the thread right? inside the > thread context. So, by doing this I could have a lenghty operation, and this > operation will not affect my main thread. Correct, all events will execute in the thread context. Dont forget to set Multithreded to True, otherwise you will have a false thread because the main thraed message pump will be used. > Correct me if I´m wrong: What would happen on first scenario is that the > main thread would be working normally receiving the network traffic and > storing it an internal buffer that I created and as the working thread is > still processing the old data, this buffer could became full in few time. Yes and then the other side will wait until buffer is ready to receive again. It will be the same in both case. > In the second, as the thread is working on the data (In the OnDataAvailable > event), it should´t process any more messages, forcing windows winsock to > notify the other side to stop sendind packets until it could process it > again. Same answer. Buffer will go full and when you receive again other side start sending again. > So, I think that if it is this that happens (I don´t really know if winsock > works like this), the second scenario would be more appropriate as the > network traffic could be suspended a little while the thread is processing > the data. You can also call Suspend / Resume to control it yourself if nececary. --- Rgds, Wilfried [TeamICS] http://www.overbyte.be/eng/overbyte/teamics.html http://www.mestdagh.biz -- To unsubscribe or change your settings for TWSocket mailing list please goto http://www.elists.org/mailman/listinfo/twsocket Visit our website at http://www.overbyte.be