TIdBytes and SendBuffer

Giganews Newsgroups
Subject: TIdBytes and SendBuffer
Posted by:  Thomas Bergerot (nospam@nospam.fr)
Date: Sun, 08 Jul 2007

Hi !

I want to send a buffer to an UDP server.

I use TIdUDPClient.SendBuffer(), but i'm a bit stuck using the TIdBytes...

I saw that TIdBytes was an array of bytes, and SendBuffer() uses
Length(Buffer) to know the size of the buffer.

So if i want to use a pchar pointing to a buffer reserved with GetMem(),
or if i want to use a record in memory, how can i do without creating a
TIdBytes and copying the buffer in it before calling SendBuffer() ?

Is there a way to cast my pchar or my record to inform SendBuffer() the
size of the argument i pass ?

Thanks to all !

Regards,

Thomas

Replies