RAD Studio VCL Reference
ContentsIndex
PreviousUpNext
TServerWinSocket.ServerType Property

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

Pascal
property ServerType: TServerType;
C++
__property TServerType ServerType;

Set ServerType to stThreadBlocking to automatically spawn a new thread for each socket connection accepted by the listening socket connection. When ServerType is stThreadBlocking, the TServerClientThread object for a 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 socket connections accepted by the listening socket asynchronously. When ServerType is stNonBlocking, all client connections are handled in a single execution thread by default. OnClientRead or OnClientWrite events occur when the server socket needs to attend to I/O over one of the connections. 

Use a non-blocking socket when reading and writing must be synchronized with client sockets.

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

 

Copyright(C) 2008 CodeGear(TM). All Rights Reserved.
What do you think about this topic? Send feedback!