System.Win.ScktComp.TServerWinSocket.OnGetThread

From RAD Studio API Documentation
Jump to: navigation, search

Delphi

property OnGetThread: TGetThreadEvent read FOnGetThread write FOnGetThread;

C++

__property TGetThreadEvent OnGetThread = {read=FOnGetThread, write=FOnGetThread};

Properties

Type Visibility Source Unit Parent
event public
System.Win.ScktComp.pas
System.Win.ScktComp.hpp
System.Win.ScktComp TServerWinSocket

Description

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

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.

See Also