 |
BorlandTalk.com Borland discussion newsgroups
|
| View previous topic :: View next topic |
| Author |
Message |
Jamie Dale Guest
|
Posted: Tue May 08, 2007 8:12 am Post subject: TIdTCPClient/Server - Read/Write at same time? |
|
|
Hi - This is a real quickie
Can the TIdTCPClient/Server read and write at the same time?
IE my Client has a reading thread (To avoid Antifreeze) BUT can it also
write at the very sam time as reading?
EG
//While Client is reading Stream (EG large file) can it write back out?
IdTCPClient1.WriteLine('anything goes while reading');
Same question applies to the TIdTCPServer too please..
Am I ok to write at the same time as reading or must I also incorporate a
data queue?
Sorry in advance if it's a dumb question.. |
|
| Back to top |
|
 |
Remy Lebeau (TeamB) Guest
|
Posted: Wed May 09, 2007 12:01 am Post subject: Re: TIdTCPClient/Server - Read/Write at same time? |
|
|
"Jamie Dale" <jamie.dale (AT) yahoo (DOT) com> wrote:
| Quote: | my Client has a reading thread (To avoid Antifreeze)
BUT can it also write at the very sam time as reading?
|
Yes. A socket has separate buffers for inbound and outbound data. It is safe to read in one thread while another thread is writing. Just do not read from multiple threads, or write from multiple threads, at the same time. That would not be safe.
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
|
|