System.Win.ScktComp.TServerSocket.OnGetThread

From RAD Studio API Documentation
Jump to: navigation, search

Delphi

property OnGetThread: TGetThreadEvent read GetGetThreadEvent write SetGetThreadEvent;

C++

__property OnGetThread;

Properties

Type Visibility Source Unit Parent
event published
System.Win.ScktComp.pas
System.Win.ScktComp.hpp
System.Win.ScktComp TServerSocket

Description

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

System.Win.ScktComp.TServerSocket.OnGetThread inherits from System.Win.ScktComp.TCustomServerSocket.OnGetThread. All content below this line refers to System.Win.ScktComp.TCustomServerSocket.OnGetThread.

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