Your design is correct altough you'd better use TWSocketServer instead of reinventing the wheel. You can set MaxClients to one to support only one client at a time.
Calling send from another thread is OK because it is protected by a critical section. Note that the prefered design is to have all communication stuff handled by a single thread and use inter-thread communication (for example Windows messages) to make a real blackbox with your communication engine. It will be much simpler to develop and debug. And you'll be forced to have a better view of what you are doing. A final note: you need to have a message pump in your thread in order to have message processing and thus events properly working. This is one more reason to have a single thread dedictaed to your communication stuff: not all COM client have a working message pump in their thread ! Contribute to the SSL Effort. Visit http://www.overbyte.be/eng/ssl.html -- [EMAIL PROTECTED] The author for the freeware multi-tier middleware MidWare The author of the freeware Internet Component Suite (ICS) http://www.overbyte.be ----- Original Message ----- From: "Markus Humm" <[EMAIL PROTECTED]> To: <twsocket@elists.org> Sent: Monday, August 07, 2006 7:59 PM Subject: [twsocket] Design verification TCP and COM-Server > Hello, > > I'm currently writing a COM-Server which also uses TWSocket for some TCP > connection. > > When the COM-Server's client calls some initializing method on my > COM-Server a TCP Socket is created which listens for a incomming > connection on a certain port. There should only exist one connection > over this TCP socket, since the server shall only serve one client. > > In the OnSessionAvailable another TWSocket is created which gets passed > over the connection. > > Is this design correct esp. for the message handling? The VCL part of > the COM server isn't involved here. I also might want to send over that > TCP-client socket from several threads. Is that okay? (because the > COM-Server uses a Single Threaded Appartment modell) > > Greetings > > Markus > > -- > 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