Hallo,
wenn ich mit
Indy einen Server erstelle (Delphi.Net) und mit diesem Daten empfangen will, bekomm ich
im eine
Exception und der Server schließt den Host:
Die Server OnExecute Funktion sieht so aus:
Delphi-Quellcode:
procedure TformMain.tcpsTestExecute(AContext: TIdContext);
var
s:
string;
begin
try
with AContext.Connection
do begin
s := IOHandler.ReadLn;
//HIER BLEIBT ER STEHEN : Danach Connection Closed Gracefully.
IOHandler.WriteLn('
Hello ' + s);
end;
except
on E:
Exception do
Console.
write(e.
message);
end;
end;
Der Client sieht so aus:
Delphi-Quellcode:
uses
IdTCPClient,
SysUtils;
begin
with TIdTCPClient.Create do try
Host := '127.0.0.2';
Port := 10001;
Connect;
try
WriteLn('Connected.');
WriteLn(IOHandler.ReadLn);
IOHandler.WriteLn('Quit');
WriteLn(IOHandler.ReadLn);
finally
Disconnect;
end;
WriteLn('Disconnected.');
finally Free; end;
WriteLn('Press Enter');
ReadLn;
end.
Wo liegt mein Fehler???
Danke,
winx