 |
BorlandTalk.com Borland discussion newsgroups
|
| View previous topic :: View next topic |
| Author |
Message |
AntonE Guest
|
Posted: Thu May 17, 2007 8:11 am Post subject: Indy 10 IOHandler write block |
|
|
Hi all,
Is there a command to write a raw block of memory over TCPclient's
IOHandler?
Something similar to file BlockWrite/read
I see Write(ABuffer:TBytes) but how to tell it how many bytes to write, or
must I make a TBytes array, copy into it & then write?
Basically just loking for a way to write raw records or memory blocks
without converting first to stream or whatever.
Thanks
AntonE |
|
| Back to top |
|
 |
Remy Lebeau (TeamB) Guest
|
Posted: Thu May 17, 2007 2:07 pm Post subject: Re: Indy 10 IOHandler write block |
|
|
"AntonE" <antone (AT) true (DOT) co.za> wrote in message
news:464c04c0 (AT) newsgroups (DOT) borland.com...
| Quote: | Is there a command to write a raw block of memory
over TCPclient's IOHandler?
|
Not directly, no. Indy 10 does not operate on raw memory, mainly for
compatibility with .NET, which does not allow raw memory access. You
would have to convert the raw memory to a TIdBytes, such as with the
RawToBytes() function, and then use the TIdIOHandler.Write(TIdBytes)
method to send that.
| Quote: | I see Write(ABuffer:TBytes) but how to tell it how many bytes to
write |
TIdBytes is a dynamic array of bytes. A dynamic array knows its own
size. Write() sends the entire array, querying the array for its
size.
| Quote: | must I make a TBytes array, copy into it & then write?
|
Yes.
| Quote: | Basically just loking for a way to write raw records or memory
blocks without converting first to stream or whatever.
|
If you use a TMemoryStream, you could call its SetPointer() method to
assign your raw memory as the stream's underlying data without
actually copying the data to a new block. You could then use
TIdIOHandler.Write(Stream) to send the original memory block as-is.
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
|
|