TWSocket has a method 'MessageLoop'. You only have to call this one
because it is pumping messages until WM_QUIT is posted to it.

To execute TWSocket in thread context you have to do this in Execute
method of thread:

- Create it in Execute method of thread
- Assign properties and event handlers
- Dont forget to set MultiThreaded := True;
- Call MessageLoop;
- Destroy the component

To post the WM_QUIT message you can use PostThreadMessage function.

A good method is to work in 3 step:

- Make a class with your communication in it, derive it from TObject
- When all works well, then derive it from TThread and fix the Execute
  method, and set MultiThread to True;
- When all works well then just create the object in the dll.

This way is only some minutes extra work, and when certainly a problem
comes up, you know it is because of Thread or because of Dll.

Rgds, Wilfried [TeamICS]

Friday, August 4, 2006, 09:43, Crafton wrote:

> Hello,

> I'm still stuck with my problems :
> http://groups.google.fr/group/borland.public.delphi.internet.winsock/browse_frm/thread/d1361882f2bf604a/a848b588964d09a2?lnk=st&q=&rnum=1&hl=fr#a848b588964d09a2

> F. Piette said to view example : there is bunch of example, the only one i
> found is the ThrdSrv.dpr ,
> this is a bit complicated for me. Is there a Threaded Client Example ?
> I have not found any Example index.

> F. Piette said also to put a Message Pump, i'm not very use to manipulate
> message.
> I don't understand how messaging works in Thread/DLL environnement and why
> my
> OnDataavailable works one time but not much more :/

> Any links/article about this will be welcome. I googled but not found any
> interesting help.

> Craft

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

Reply via email to