BorlandTalk.com Forum Index BorlandTalk.com
Borland discussion newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Indy 10 IOHandler write block

 
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi Internet Winsock
View previous topic :: View next topic  
Author Message
AntonE
Guest





PostPosted: Thu May 17, 2007 8:11 am    Post subject: Indy 10 IOHandler write block Reply with quote



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





PostPosted: Thu May 17, 2007 2:07 pm    Post subject: Re: Indy 10 IOHandler write block Reply with quote



"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
Display posts from previous:   
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi Internet Winsock All times are GMT
Page 1 of 1

 
Jump to:  
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


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.