Hello Jacco, > I'm not that familair with building multi-threaded applications, I
But are you sure you neec multi threading ? Can you give reason wy you think it should be or tell something more about your application. You can easy have honderts of connections running in 1 thread (main thread). > When I connect in the main > thread and create a thread in the onsessionconnect event, it works. Not good. You have to TreadAttach the socket if needed. Or create a thread for the lengty work you want to do (if this is the reason). > But when I terminate the thread and want to reconnect in the main > thread, I get a Winsock error (10022). 10022 is 'invalid argument', can be whatever wrong parameter or pointer. Never seen this error... > So I have got it working as an object in the main thread. Can I put > all the code in the thread execute part? Think very object oriented. for example make an object TConnection whitch will do all the work. TConnection has properties and events. If TConnection wants to tell somethign (eg data) to the application it can fire an event. When you create TConnection it should do all his job independant of the application. When it works without bug all is fine. All components should be created in TConnection. When you then create the TConnection to an Execute method of a thread you will have threded code if you fulfill some things. All events you can pass to main application by posting a message. Same for all methods. Since you only have to change public things it is only minor work. But first let's consider if you really need multithreading ! --- Rgds, Wilfried http://www.mestdagh.biz Wednesday, September 21, 2005, 15:30, Jacco Bezemer wrote: > Hi Wilfried, > I'm not that familair with building multi-threaded applications, I > gave it a try but I didn't get it working. When I connect in the main > thread and create a thread in the onsessionconnect event, it works. > But when I terminate the thread and want to reconnect in the main > thread, I get a Winsock error (10022). > So I have got it working as an object in the main thread. Can I put > all the code in the thread execute part? > Thanks in advance, > Jacco > On 9/21/05, Wilfried Mestdagh <[EMAIL PROTECTED]> wrote: >> Hello Jacco, >> >> There is no difference if you wants to do in a thread if all your code >> is thread safe, and you need a message pump in the thread. >> >> The most easy way is to develop / test all in main thread, so that you >> know that eventually bugs are not because of threaded code bugs. To do >> so you make a separate object where all code is in that you need. >> >> Later when all is ready you just create / free your object in the >> threads execute method. To have a message pump you can use message pump >> from TWSocket. >> >> --- >> Rgds, Wilfried >> http://www.mestdagh.biz >> >> Wednesday, September 21, 2005, 12:54, Jacco Bezemer wrote: >> >> > Hi, >> >> > I want to connect (and reconnect) within a thread and send XML data >> > within that same thread. >> >> > How do I accomplisch this? Can someone help me on this? >> >> > I'm using Delphi 7. >> >> > Thanks in advance, >> > Jacco >> >> -- >> 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 >> -- 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