I am writing a C/S app that communicates over TCP/IP to a mainframe. This app will have many forms. In the past my approach has been to put the winsock control on my main form and have whatever form that needed to send some data simply reference the main form. The recieve was much harder though since the recieve fires whenever something is received. What I did in my previous apps was simply do the send, switch to an hourglass, and wait till the recieve fired. When it did, it would receive the data and I kept track of what function it was going prior to the send so it knew to unlock the screen and resume processing.

What I would like to acheive however is some was to simply allow the recieve to run in the background and accumulate the data in a buffer or string until I want to extract some data from it. This way I could for example, send some data, wait a few seconds, then enter a loop to receive the data from the buffer or string WITHIN THE SAME PROCEDURE and continue processing. What happens how is the recieve event fires and my program jumps to the receive event and doesn't return to where it left off obviously.

So has anyone had experience with this situation and if how how did you resolve it? I am thinking maybe there is a way to put the control into a .bas module or maybe buying a control that has this functionality.