It's not hard but inconvenient. What if the TStream is a TFileStream with a 100 MB file opened? Will you allocate 100 MB of memory, copy it all there and send all data at once? Probably not. They should have included a function which will automaticly send a TStream's content by chunks (you can always write such a function yourself though).
As a side note, the code you have posted is wrong. It should be like this:
Code:
var
bytes: TBytes;
begin
SetLength(bytes, stream.Length);
Stream.Read(bytes[0], stream.Length);
end;
Bookmarks