System.Win.ScktComp.TCustomServerSocket.OnGetThread

From RAD Studio API Documentation
Jump to: navigation, search

Delphi

property OnGetThread: TGetThreadEvent read GetGetThreadEvent  write SetGetThreadEvent;

C++

__property TGetThreadEvent OnGetThread = {read=GetGetThreadEvent, write=SetGetThreadEvent};

Properties

Type Visibility Source Unit Parent
event protected
System.Win.ScktComp.pas
System.Win.ScktComp.hpp
System.Win.ScktComp TCustomServerSocket

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. 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.

See Also