Newsgroups : Borland : borland.public.delphi.internet.winsock : 2006 Jul : [ICS] Twsocket/onDataAvailable in a DLL, called by a Thread

www.cryer.info
Managed Newsgroup Archive

[ICS] Twsocket/onDataAvailable in a DLL, called by a Thread

Subject:[ICS] Twsocket/onDataAvailable in a DLL, called by a Thread
Posted by:"Craft" (cra..@nomail.com)
Date:Wed, 12 Jul 2006 09:15:05

Hello,

I have made a dll to communicate via socket with a complex system.
My dll have 3 fonction
Connect/Send/Disconnect
All use the same Twsocket, only one client.


When user SEND a command he receive 1 result :
but the dll receive 2 message from the complex system
- one to acknowledge command.
- one when the command is done.
The dll must wait between the two message
i have made that in this way :


send the command


// wait ack
Repeat
   application.processmessage // to let ondataavailable be catched
until flag set by ondataavailable or timeout


// wait done
Repeat
   application.processmessage // to let ondataavailable be catched
until flag set by ondataavailable or timeout
return result to dll send


It works well if the dll user call it sequentially
connect
send ...
send ...
etc ...
disconnect


My probleme come when the dll user call it from a thread


Connect
   [Thread] send ....   the first one work (ICS OndataAvailable works Ok)
   [Thread] send ....   the second i never have OndataAvaible << here is the problem !!
   [Thread] etc ..
Disconnect


I'm don't know too much about how windows messaging works while in a thread any help will be welcome


TIA


Thanks To F. Piette for this great lib

Replies:

www.cryer.info
Managed Newsgroup Archive