 |
BorlandTalk.com Borland discussion newsgroups
|
| View previous topic :: View next topic |
| Author |
Message |
Thomas Wegner Guest
|
Posted: Fri Nov 12, 2004 1:34 pm Post subject: Indy 10 ReadBuffer, WriteBuffer, where? |
|
|
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
|
|
| Back to top |
|
 |
Remy Lebeau (TeamB) Guest
|
Posted: Fri Nov 12, 2004 6:24 pm Post subject: Re: Indy 10 ReadBuffer, WriteBuffer, where? |
|
|
"Thomas Wegner" <tomaten (AT) t-online (DOT) de> wrote
| Quote: | how i can replace the missed functions ReadBuffer
and WriteBuffer in TIdTCPConnection?
|
Use the ReadBytes() and Write(TIdBytes) methods of TIdIOHandler instead,
respectively.
Gambit
|
|
| Back to top |
|
 |
Thomas Wegner Guest
|
Posted: Fri Nov 12, 2004 8:00 pm Post subject: Re: Indy 10 ReadBuffer, WriteBuffer, where? |
|
|
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.spam (AT) no (DOT) spam.com> schrieb im Newsbeitrag
news:4194ff7d (AT) newsgroups (DOT) borland.com...
| Quote: |
"Thomas Wegner" <tomaten (AT) t-online (DOT) de> wrote in message
news:4194bbe7$1 (AT) newsgroups (DOT) 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
|
|
|
| Back to top |
|
 |
Remy Lebeau (TeamB) Guest
|
Posted: Fri Nov 12, 2004 9:04 pm Post subject: Re: Indy 10 ReadBuffer, WriteBuffer, where? |
|
|
"Thomas Wegner" <tomaten (AT) t-online (DOT) de> wrote
| Quote: | 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
|
|
| Back to top |
|
 |
Thomas Wegner Guest
|
Posted: Fri Nov 12, 2004 11:52 pm Post subject: Re: Indy 10 ReadBuffer, WriteBuffer, where? |
|
|
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.spam (AT) no (DOT) spam.com> schrieb im Newsbeitrag
news:419524f5$1 (AT) newsgroups (DOT) borland.com...
| Quote: |
"Thomas Wegner" <tomaten (AT) t-online (DOT) de> wrote in message
news:4195164f$1 (AT) newsgroups (DOT) 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
|
|
|
| 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
|
|