|Subject:||Re: Reading Strings with TCPServer/Client|
|Posted by:||Remy Lebeau (TeamB) (gambit…@yahoo.com)|
|Date:||Fri, 19 Sep 2003|
"Tobias Müller" <ne…@twam.info> wrote in message
> With the ClientSocket and ServerSocket components I could
> use the OnClientRead/OnClientWrite and OnRead/OnWrite
> Events but I can't find suck Events in the TCPServer and
> TCPClient component of Indy. How to realize this?
Indy servers have an OnExecute event that you can use to read the socket for
new data. The reading will not return until new data actually arrives, or
an error occurs. OnExecute is triggered in the context of the internal
worker threads of each connection, so reading a socket will not block the
rest of your code.
Indy clients are not event driven, so you will just have to poll the client
socket periodically to see if new data is available. You can use the
Readable() method of the IOHandler property for that. Alternative, you can
use the socket in a separate thread instead, in which case when you read the
socket, it will simply block the thread until new data actually arrives, or
an error occurs.
Reading Strings with TCPServer/Client posted by Tobias Müller on Fri, 19 Sep 2003