aingham
March 11th, 2009, 07:44 PM
I am having major troubles trying to come up with a code design for what I need to do. My situation is this:
I have two applications that I want to communicate to each other using sockets.
The program that I need to be the server uses a program specific programming language and so I have no socket API to utilise.
The program does however allow you to call a DLL and execute a DLL function.
I have tried calling my socket code from the DLL but the calling program hangs because within the socket code I am calling a continuous loop that does not return control back to the calling program.
The callling program states in its help that any process that is expected to take a long time should be started as a separate Windows thread.
The concept I am trying to grasp is hw can I continuously monitor the socket using a DLL function whilst still returning control to the calling application?
I have tried starting a new thread from within the DLL but I am not exactly sure how this works, if I return control to the calling program does this "kill" the new thread I have started? If not how do I communicate with the thread if say there is some information coming in from the socket?
Any help would be much appreciated.
I have two applications that I want to communicate to each other using sockets.
The program that I need to be the server uses a program specific programming language and so I have no socket API to utilise.
The program does however allow you to call a DLL and execute a DLL function.
I have tried calling my socket code from the DLL but the calling program hangs because within the socket code I am calling a continuous loop that does not return control back to the calling program.
The callling program states in its help that any process that is expected to take a long time should be started as a separate Windows thread.
The concept I am trying to grasp is hw can I continuously monitor the socket using a DLL function whilst still returning control to the calling application?
I have tried starting a new thread from within the DLL but I am not exactly sure how this works, if I return control to the calling program does this "kill" the new thread I have started? If not how do I communicate with the thread if say there is some information coming in from the socket?
Any help would be much appreciated.