RAD Studio VCL Reference
ContentsIndex
PreviousUpNext
TServerWinSocket.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. Create the new thread with the CreateSuspended parameter set to false, and return it in the SocketThread parameter. OnGetThread only occurs if there are no idle threads in the cache. 

Most applications that use thread-blocking connections will want to create a new descendant of TServerClientThread in an OnGetThread event handler. This is because the default behavior of TServerClientThread uses the OnClientRead and OnClientWrite event handlers for reading and writing. These events occur on the server socket, which is not thread-local. 

The Sender parameter is the TServerWinSocket object that received the client request. The ClientSocket parameter is the TServerClientWinSocket object that will communicate with the client socket.

Note: The OnGetThread event handler for TServerWinSocket is also set when setting the OnGetThread event handler of the associated TServerSocket.
 

 

Copyright(C) 2009 Embarcadero Technologies, Inc. All Rights Reserved.
What do you think about this topic? Send feedback!