Я использую форму с IdTCPServer для управления строками от клиента с системой AThread.connection.readln / writeln. Обработка строк работает, и это не проблема.
Дело в том, что форма с сервером на нем зависает и не загружается, но она по-прежнему управляет всеми подключенными к ней клиентами, поэтому она работает, но она просто не работает как форма.
Я сделаю предположение, что это сидит на readline или что-то ... но я понятия не имею, как я могу это исправить в данный момент времени.
Пожалуйста, помогите.
procedure TMonitorFrm.ServerExecute(AThread: TIdPeerThread);
procedure post(PostMessage:string);
begin
try
AThread.Connection.WriteLn(PostMessage);
except
showmessage('Cannot post');
end;
end;
var
ActClient : PClient;
sTemp,
CommBlock,
NewCommBlock,
ReceiverName,
sContent,
sSQL,
sCommand : String;
iCount2,
iCount : Integer;
sldb : TSQLiteDatabase;
sltb : TSQLiteTable;
begin
if not AThread.Terminated and AThread.Connection.Connected then
begin
CommBlock := AThread.Connection.ReadLn();
ActClient := PClient(AThread.Data);
ActClient.LastAction := Now;
sCommand := copy(CommBlock,0,pos(',',CommBlock)-1); {seperate command}
sContent := copy(CommBlock,pos(',',CommBlock)+1,length(CommBlock)-(pos(',',CommBlock)+1)); {seperate data block}
iCount:= 0 ;
if sCommand = 'Announce' then //SPECIAL
begin
{ Do stuff for this command...}
end
else if sCommand = 'CheckSect' then
{Etcetera...}
procedure TMonitorFrm.FormCreate(Sender: TObject);
var
sCompetitionID : string;
sldb : TSQLiteDatabase;
sltb : TSQLiteTable;
begin
Clients := TThreadList.Create;
Server.Active := True;
AreaPnlList := TComponentList.Create;
SectionPnlList := TComponentList.Create;
Repeat until InputQuery('Competition Select', 'Please type the ID of the competition', sCompetitionID);
iCompetitionID:=StrToInt(sCompetitionID);
OpenDatabase(slDb);
sltb:=slDb.GetTable('SELECT * FROM SectionTable WHERE CompetitionID='+sCompetitionID);
Frame31.CreateSections(sltb,Frame31);
sltb.Free;
CloseDatabase(slDb);
{
This section needs to check the SQLite databases for sections and list them in the display window and makes a drag n drop profile...
}
end;