RAD Studio VCL Reference
ContentsIndex
PreviousUpNext
TCustomServerSocket.OnGetThread Event

Occurs when the server socket needs to create a new execution thread for a connection to a client socket.

Pascal
property OnGetThread: TGetThreadEvent;
C++
__property TGetThreadEvent OnGetThread;

Write an OnGetThread event handler to create a specialized descendant of TServerClientThread for the connection to the client socket. Return the new TServerClientThread object in the SocketThread parameter.  

Most applications that use thread-blocking server components will want to provide an OnGetThread event handler and implement a TServerClientThread that handles its own reading and writing in a thread-safe manner rather than relying on the default TServerClientThread which triggers OnClientRead and OnClientWrite events. This is because the OnClientRead and OnClientWrite event handlers reside on the server socket, which is in global memory. 

The Sender parameter is the TServerWinSocket object that describes the server endpoint of the listening connection. The ClientSocket parameter is the TServerClientWinSocket object that describes the server endpoint of the connection to the client socket that is about to be formed. 

 

Copyright(C) 2008 CodeGear(TM). All Rights Reserved.
What do you think about this topic? Send feedback!