Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Indy 10 ReadBuffer, WriteBuffer, where?

60 views
Skip to first unread message

Thomas Wegner

unread,
Nov 12, 2004, 8:34:30 AM11/12/04
to
Hello,

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


Remy Lebeau (TeamB)

unread,
Nov 12, 2004, 1:24:28 PM11/12/04
to

"Thomas Wegner" <tom...@t-online.de> wrote in message
news:4194bbe7$1...@newsgroups.borland.com...

> how i can replace the missed functions ReadBuffer
> and WriteBuffer in TIdTCPConnection?

Use the ReadBytes() and Write(TIdBytes) methods of TIdIOHandler instead,
respectively.


Gambit


Thomas Wegner

unread,
Nov 12, 2004, 3:00:08 PM11/12/04
to
Is there any example? How must i use my buffer with
TIdBytes (read and write buffer)?

---------------------------------------------
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:4194...@newsgroups.borland.com...

Remy Lebeau (TeamB)

unread,
Nov 12, 2004, 4:04:20 PM11/12/04
to

"Thomas Wegner" <tom...@t-online.de> wrote in message
news:4195164f$1...@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


Thomas Wegner

unread,
Nov 12, 2004, 6:52:37 PM11/12/04
to
Thank you. I changed following now (for others):

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...

0 new messages