 |
BorlandTalk.com Borland discussion newsgroups
|
| View previous topic :: View next topic |
| Author |
Message |
Miraka Guest
|
Posted: Sun Aug 20, 2006 8:11 am Post subject: TIdUDPClient and other indy clients |
|
|
How can I determine if the TIdUDPClient is ready to read the data.. there is
no OnRead event. I know thaht Indy is blocking but isn't there a way to read
the data only when it is available (I don't want to use TIdAntiFreeze).
Currently I'm using a TIdUDPServer instead of TIdUDPClient because it has
OnUDPRead event but this is not the correct way I think.
Regards.. |
|
| Back to top |
|
 |
Remy Lebeau (TeamB) Guest
|
Posted: Mon Aug 21, 2006 7:10 am Post subject: Re: TIdUDPClient and other indy clients |
|
|
"Miraka" <ak_47 (AT) abv (DOT) bg> wrote in message
news:44e80e21$1 (AT) newsgroups (DOT) borland.com...
| Quote: | How can I determine if the TIdUDPClient is ready to read the data..
|
The only way to check for readibility, without actually reading, is to call
the Binding's Readable() method. Otherwise, just read and let the client
block until the data arrives. That is how Indy is primarily designed to be
used.
| Quote: | there is no OnRead event.
|
For the large part, Indy is not an event driven library to begin with. Do
not rely on events in client components (except for TIdTelnet or TIdIRC,
which do have events when data arrives) to do your work. Just call a
reading method and wait for the data to arrive. If you do not want to block
the main UI
thread, then do the reading in a worker thread.
| Quote: | I know thaht Indy is blocking
|
You are asking for a non-blocking solution.
| Quote: | but isn't there a way to read the data only when it is available
|
Indy (and blocking sockets in general) is designed to wait until the data is
available. Call a reading method, and it will not exit until the data
arrives, or until a timeout occurs.
| Quote: | I don't want to use TIdAntiFreeze
|
Then you have to do blocking reads in a worker thread. That is how Indy
servers are able to provide such events, by the way.
Gambit |
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|