I have a Delphi 6 application that uses the ICS component package for socket communication. I have my own VCL server component that creates client TWSocket sockets when a new session becomes available. The client sockets that I create have the Multithreaded property set to TRUE, but all that does is change how the client socket handles socket messages in a way that is safe from the background thread (non-main VCL thread). TWSocket does not create a stream for processing socket data traffic that I need.
I need reception calls to be made from the main VCL stream, the main user interface stream, because incoming data to the client socket is audio data that needs to be processed quickly, in 50-100 milliseconds or less. In other words, one hiccup on the main VCL stream and audio stream is broken. This is why I want to push the OnDataAvailable () event, which fires when incoming data is available for a high priority background thread. In other words, I want to force the message processing loop belonging to the client TWSocket object to the background thread.
I believe that I can do this by creating a client socket through a background thread, but I hope to avoid this, as I am currently using the VCL component that I made that acts as a socket server. This is an object that accepts an incoming connection and spawns client sockets. A socket server is created in the main VCL thread.
So my question is: is there a (relatively) easy way to create client sockets so that they use the existing background thread to process their sockets, especially for handling FD_RECV messages? If there is no existing background thread, then I will create one for each client socket being created, but I need to know how to make sure that the new TWSocket object uses this background thread when it starts its message loop that processes socket messages, so how do I do it ?