You should not be using Readable() like that. Try the following instead:
procedure TFormMain.IdTCPServerExecute(AContext: TIdContext);
var
RxBuf: TIdBytes;
begin
RxBuf := nil;
with AContext.Connection.IOHandler do
begin
CheckForDataOnSource(10);
if not InputBufferIsEmpty then
begin
InputBuffer.ExtractToBytes(RxBuf);
// process RxBuf as needed...
end;
end;
end;
Alternatively:
procedure TFormMain.IdTCPServerExecute(AContext: TIdContext);
var
RxBufStr: String; // not UTF8String
begin
with AContext.Connection.IOHandler do
begin
CheckForDataOnSource(10);
if not InputBufferIsEmpty then
begin
RxBufStr := InputBuffer.Extract(-1, enUtf8);
// Alternatively to above, you can set the
// InputBuffer.Encoding property to enUtf8
// beforehand, and then call TIdBuffer.Extract()
// without any parameters.
//
// Or, set the IOHandler.DefStringEncoding
// property to enUtf8 beforehand, and then
// call TIdIOHandler.InputBufferAsString()
// process RxBufStr as needed...
end;
end;
end;
As for TIdSchedulerOfFiber - the SuperCore package is effectively dead at this time. It has not been worked on in a very long time, and is not up-to-date with the latest Indy 10 architecture. We may try to resurrect it at a later date, but it is not in our plans for the near future.
[Installing Indy for Delphi XE]
Yes, the install process is tedious, but it's worth it to get it done right.
This is for all Indy components except SSL. (I haven't tried any of the SSL stuff yet.)
A.) Seek and destroy all Indy files that come with Delphi. These are
no good as the Indy project is updated every single day with new bug fixes.
If Delphi picks up any of the old files instead of your new fresh Indy library,
you will get crazy errors from the IDE at all different times that are very hard to
trace.
i. Go to Component-->Install Packages, then completely remove all packages that start with "Indy".
ii. Close Delphi.
iii. Erase all files that match "dclIndy*.bpl" and "Indy*.bpl" from Delphi's Bin folder.
(C:\Program Files\Embarcadero\RAD Studio\8.0\bin)
iv. Erase all files that match "Indy*.dcu" and "Id*.dcu"^^^ in Delphi's Lib sub folders.
(C:\Program Files\Embarcadero\RAD Studio\8.0\lib\win32\debug)
(C:\Program Files\Embarcadero\RAD Studio\8.0\lib\win32\release)
^^^ Warning: watch out for non-Indy DCUs that happen to begin with the letters "id"
like "idispids.dcu" and "idoc.dcu"
v. Delete the entire Indy10 source folder:
(C:\Program Files\Embarcadero\RAD Studio\8.0\source\Indy10)
B.) Download the latest Indy10_XXXX.zip from http://indy.fulgan.com/ZIP/
(If you get a compile error or runtime error using this zip file for any of the steps
below -- don't be discouraged! Re-download the zip file on the following day and try
again. This zip file gets updated every day and there is a chance that there may be
some bugs/errors on any given day.)
C.) Extract only the System, Core, and Protocols folders into your own Indy library folder. ex.
(c:\MyDelphiComponents\Indy\Core)
(c:\MyDelphiComponents\Indy\System)
(c:\MyDelphiComponents\Indy\Protocols)
D.) Launch Delphi. Ignore all failed package dialogs: These are the Embarcadero packages
that rely on Indy! (Just click Ok on all errors, and indicate that any failed
packages should not be loaded again.)
E.) Go to Options-->Environment Options-->Delphi Options-->Browsing Path
- Remove paths that start with $(BDS)\Lib\Indy10
F.) Go to Options-->Environment Options-->Delphi Options-->Library Path
- Add your new System, Core, and Protocols folders from step C to Delphi's library path.
G.) Perform the following 5 actions in order:
(Just say OK to any dialogs about upgrading the project.)
Important:
After loading each dpk and before each build, go to:
Project-->Options-->Description-->Build Control
Set radio button to "Explicit Rebuild".
(Actually, this is optional, but I always make packages Explicit Rebuild
because they seem easier to handle that way, but I'd like to hear what
other people think about this...)
- Build - System\IndySystem150.dpk
- Build - Core\IndyCore150.dpk
- Build first,
then Install - Core\dclIndyCore150.dpk
- Build - Protocols\IndyProtocols150.dpk
- Build first,
then Install - Protocols\dclIndyProtocols150.dpk
** Double check that you've set "Explicit Rebuild" on all packages! **
H.) Finally, go to Component-->Install Packages and find all of the packages that rely
on Indy that were turned off during step D. Reactivate them, and restart Delphi.
(If your new Indy hasn't changed too much from the one released with Delphi, those
packages will use the new Indy!)
++ Note, you may not receive any errors right away when reactivating those Embarcadero
packages, but they may pop up at random times later. For example, I just installed
Indy10_4548.zip and all the reactivated packages seemed fine. Then a day later out of
the blue, the IDE threw me a message that said it couldn't find GetRequestHeaders in
TIdCustomHTTP and that the dclWindowsAzureManagement150.bpl was having trouble as a
result. So I had to go back and disable that Windows Azure package in the IDE.
Best Answer
I did this very recently, I've done it before with 2007 and had lots of problems, but this time in D2010 it went really well...
Assumptions:
Directions:
So, I took the BPL/DCP/DCU files and saved them somewhere safe (just in case) I renamed the core/protocol/system folders to core.old/protocol.old/system.old I then copied the core/protocol/system folders from the indytiburon.zip into source\indy\indy10 folder
Now, the packages have to be built in the following order:
System - Core - Protocol - dclCore - dclProtocol
For Delphi 2009, open the packages whose names end in 130; for Delphi 2010, 140.
I opened each package, then in the options I pasted the full path to lib\Indy10\ into the DCP and Unit output directory fields, and the full path to bin\ into the package output directory field.
Then I
built
the packages. For the dcl packages I alsoinstalled
.Certainly for 2010 it went without a hitch!