RAD Studio VCL Reference
ContentsIndex
PreviousUpNext
TClientSocket.ClientType Property

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

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

Set ClientType to ctNonBlocking to enable the client socket to respond to asynchronous reading and writing events. When ClientType is ctNonBlocking, execution is not blocked by reading and writing over the socket connection. OnRead or OnWrite events occur when the socket needs to read or write over the connection. 

Set ClientType to ctBlocking to force all reading and writing to occur synchronously. It is a good idea to include the client socket object in a thread if the ClientType is ctBlocking, so that I/O does not block all execution within the client application.  

When ClientType is ctBlocking, use a TWinSocketStream object for reading and writing. TWinSocketStream prevents the application from hanging indefinitely if a problem occurs while reading or writing. It also can wait for the socket connection to indicate its readiness for reading.  

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!