API:System.Win.ScktComp.TServerSocket.ServerType

From RAD Studio API Documentation
Jump to: navigation, search

Delphi

property ServerType: TServerType read GetServerType write SetServerType;

C++

__property ServerType;

Properties

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

Description

Specifies whether each connection accepted by the server socket is non-blocking, or if it is automatically given a separate execution thread.

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

Specifies whether each connection accepted by the server socket is non-blocking, or if it is automatically given a separate execution thread.

Set ServerType to stThreadBlocking to automatically spawn a new thread for each socket connection accepted by the server socket. When ServerType is stThreadBlocking, the execution of the connection thread is suspended while reading or writing until all information has been transferred over the connection. The thread for each connection generates OnClientRead or OnClientWrite events when the server socket needs to read or write.

Set ServerType to stNonBlocking to handle all reading and writing over the socket connections asynchronously. When ServerType is stNonBlocking, all client connections are handled in a single execution thread by default. OnClientRead or OnClientWrite events occur when the client socket on the other end of one of the connections tries to send or receive information over the connection.

Use a non-blocking socket when the socket needs to synchronize reading and writing with client sockets.

Note: When ServerType is stThreadBlocking, it is important that the OnClient... event handlers contain thread-safe code.

See Also