how i can replace the missed functions ReadBuffer
and WriteBuffer in TIdTCPConnection?
---------------------------------------------
Thomas Wegner
Cabrio Meter - The Weather Plugin for Trillian
http://trillian.wegner24.de/cabriometer
> how i can replace the missed functions ReadBuffer
> and WriteBuffer in TIdTCPConnection?
Use the ReadBytes() and Write(TIdBytes) methods of TIdIOHandler instead,
respectively.
Gambit
"Remy Lebeau (TeamB)" <no....@no.spam.com> schrieb im Newsbeitrag
news:4194...@newsgroups.borland.com...
> Is there any example? How must i use my
> buffer with TIdBytes (read and write buffer)?
It would help if you could show what you are actually trying to send/read in
the first place.
In general, Indy 10 does not support operations are raw memory anymore.
This is required in order to support DotNet. TIdBytes is just an array of
bytes. When calling Write(), you have to allocate a TIdBytes and put your
raw data into it. When calling ReadBytes(), a TIdBytes is returned
containing the data, so just extract your data from it as needed. For
example:
// writing...
var
Buf: TIdBytes;
begin
//...
Buf := Idglobal.RawToBytes(YourRawData, SizeOfYourRawData);
...Write(Buf);
//...
end;
// reading...
var
Buf: TIdBytes;
begin
//...
...ReadBytes(Buf, NumberOfBytes);
Idglobal.BytesToRaw(Buf, YourRawData, NumberOfBytes);
//...
end;
Make sure to download the latest snapshot of Indy 10, I just added the
BytesToRaw() function to Indy 10 a few minutes ago.
Gambit
Indy9:
Context.Connection.ReadBuffer(buffer^, size);
Indy10:
Buf : TIdBytes;
...
Context.Connection.IOHandler.ReadBytes(Buf, size);
BytesToRaw(Buf, buffer^, size);
and
Indy9:
Context.Connection.WriteBuffer(Buffer, Count);
Indy10:
Buf : TIdBytes;
...
Buf := RawToBytes(Buffer, Count);
Context.Connection.IOHandler.Write(Buf);
---------------------------------------------
Thomas Wegner
Cabrio Meter - The Weather Plugin for Trillian
http://trillian.wegner24.de/cabriometer
"Remy Lebeau (TeamB)" <no....@no.spam.com> schrieb im Newsbeitrag
news:419524f5$1...@newsgroups.borland.com...