ScktComp.TServerWinSocket.OnGetThread

From RAD Studio VCL Reference
Jump to: navigation, search

Contents

Delphi Information

From ScktComp.pas

	property OnGetThread: TGetThreadEvent read FOnGetThread write FOnGetThread;


Unit: ScktComp

Type: event

Visibility: public

Member Of: TServerWinSocket

C++ Information

From ScktComp.hpp

	__property TGetThreadEvent OnGetThread;


Unit: ScktComp

Type: property

Visibility: public

Member Of: 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

Personal tools
Translations
Newest Version