RAD Studio VCL Reference
ContentsIndex
PreviousUpNext
TClientWinSocket.ClientType Property

Specifies whether the client Windows socket reads and writes information asynchronously over the socket connection.

Pascal
property ClientType: TClientType;
C++
__property TClientType ClientType;

Client socket components set ClientType to reflect their own ClientType property. When ClientType is ctNonBlocking, the client Windows socket responds to asynchronous reading and writing events, and execution is not blocked by reading and writing over the connection. OnSocketEvent events occur when the socket needs to read or write over the connection. 

When ClientType is ctBlocking, all reading and writing occur synchronously. It is a good idea to perform all reading and writing in a separate thread if ClientType is ctBlocking. Reading and writing in a separate thread ensures that these operations do not block all execution within the client application.  

When ClientType is ctBlocking, use a TWinSocketStream object for reading and writing. TWinSocketStream times out so that the application does not hang when a problem occurs while reading or writing. TWinSocketStream also provides a method to wait, before reading, until the socket connection is ready to send information. 

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

 

Copyright(C) 2009 Embarcadero Technologies, Inc. All Rights Reserved.
What do you think about this topic? Send feedback!