Einzelnen Beitrag anzeigen

samso

Registriert seit: 29. Mär 2009
439 Beiträge
 
#2

Re: Problem: Indy-Thread und Pointer

  Alt 14. Jul 2009, 17:38
vielleicht funktioniert dies (quick & dirty):

Delphi-Quellcode:
  TForm1
  ....
  private
    withandle: TwitHandle;
    procedure DoCloseWit;
    procedure DoStartWit;
  ...


procedure TForm1.DoCloseWit;
begin
  WitDllExit(withandle);
end;

procedure TForm1.DoStartWit;
begin
  withandle := witDLLInit4(Pointer(Handle), 0, nil, nil, 0, nil);
end;

...

procedure TForm1.IdTCPServer1Execute(AThread: TIdPeerThread);
var
    Command : String;
    temp: String;
begin
  Command := AThread.Connection.ReadLn;
  Command := uppercase(Command);
  if (Command = 'LOADDLL') then [b]//starten[/b]
  begin
    AThread.Synchronize(DoStartWit);
    temp:='DLL_LOADED' + chr(10);
   AThread.Connection.Write(temp);
  end
  else if (Command = 'UNLOADDLL') then [b]//beenden[/b]
  begin
   AThread.Synchronize(DoStopWit);
   temp:='DLL_UNLOADED' + chr(10);
   AThread.Connection.Write(temp);
  end
  else
  begin
    temp:='NOK:UNKNOWN_COMMAND' + chr(10);
    AThread.Connection.Write(temp);
  end;
end;
Was ist, wenn mehrere Clients auf den Server zugreifen?
  Mit Zitat antworten Zitat