"Mike" <
XXXX@XXXXX.COM>writes
Quote
was Client.IOHandler.WriteBuffer(s[1], Length(s));
There was no WriteBuffer() method in TIdIOHandler of older versions.
WriteBuffer() was implemented in TIdTCPConnection instead:
Client.WriteBuffer(s[1], Length(s));
Which you could have just used Write(String) instead:
Client.Write(s);
Quote
Now ?
TIdTCPConnection.Write(String) was moved into the TIdIOHandler class in Indy
10:
Client.IOHandler.Write(s);
TIdTCPConnection.WriteBuffer() was also moved into TIdIOHandler, but it was
also renamed to an be a Write() overload, and its parameters were changed to
accept a TIdBytes instead. You can not use directly memory pointers in Indy
10 because of the .NET support. So you have to copy your data into a
TIdBytes first, such as with the ToBytes() function:
Client.IOHandler.Write(ToBytes(s));
Or the RawToBytes() function:
Client.IOHandler.Write(RawToBytes(s[1], Length(s)));
Or else store the data into a TStream and send that instead:
var Strm: TStream;
Strm := TStringStream.Create(s);
Client.IOHandler.Write(Strm);
Strm.Free;
Quote
was Client.IOHandler.ReadBuffer(s[1], i);
Again, such a method was implemented in TIdTCPConnection, not TIdIOHandler,
in older versions:
Client.ReadBuffer(s[1], i);
Which you could have just used ReadString() instead:
s := Client.ReadString(i);
Quote
Now?
Like Write(String), ReadString() was moved to TIdIOHandler as well:
s := Client.IOHandler.ReadString(i);
And like WriteBuffer(), ReadBuffer() was also moved, renamed, and changed in
Indy 10. It is now ReadBytes() in TIdIOHandler:
var buf: TIdBytes;
Client.ReadBytes(buf, i);
BytesToRaw(buf, s[1], i);
// or s := BytesToString(buf, i);
Or read a stream:
var Strm: TStream;
Strm := TStringStream.Create('');
Client.IOHandler.ReadStream(Strm, i);
s := Strm.DataString;
Strm.Free;
Quote
was Context.Connection.IOHandler.WriteBuffer(msg[1], length(msg));
Now?
Same as above:
Context.Connection.IOHandler.Write(msg);
Or:
Context.Connection.IOHandler.Write(ToBytes(msg));
Or:
Context.Connection.IOHandler.Write(RawToBytes(msg[1], Length(msg)));
Quote
Was I := AContext.Connection.IOHandler.Buffer.Size;
There was no Buffer property of TIdIOHandler in older versions. There was
an InputBuffer property in TIdTCPConnection, though:
I := AThread.Connection.InputBuffer.Size;
Which was then moved into TIdIOHandler in Indy 10:
I := AContext.Connection.IOHandler.InputBuffer.Size;
Quote
was AContext.Connection.IOHandler.ReadBuffer(S[1], I);
Now?
Same as above:
S := AContext.Connection.IOHandler.ReadString(I);
Or:
var buf: TIdBytes;
AContext.Connection.IOHandler.ReadBytes(buf, i);
BytesToRaw(buf, S[1], i);
// or S := BytesToString(buf, I);
Or:
Strm := TStringStream.Create('');
AContext.Connection.IOHandler.ReadStream(Strm, I);
S := Strm.DataString;
Quote
was AContext.Connection.IOHandler.WriteBuffer(s[1], Length(s));
Now?
Same as above:
AContext.Connection.IOHandler.Write(s);
Or:
AContext.Connection.IOHandler.Write(ToBytes(s));
Or:
AContext.Connection.IOHandler.Write(RawToBytes(s[1], Length(s)));
Or:
var Strm: TStream;
Strm := TStringStream.Create(s);
AContext.Connection.IOHandler.Write(Strm);
Strm.Free;
Quote
was AContext.Connection.LocalName
Now
That property was taken out of TIdComponent in Indy 10. All it did was
return the result of the global GStack.WSGetHostName() method. In Indy 10,
you need to read the global GStack.HostName property directly now.
Gambit