Перерыл пол-интернета и так и не нашел полноценного примера IdTCPServer на Indy. Может кто нибудь помочь?
- Код: Выделить всё
program test;
{$mode objfpc}{$H+}
uses
{$IFDEF UNIX}{$IFDEF UseCThreads}
cthreads,
{$ENDIF}{$ENDIF}
Classes, IdTCPServer, IdContext
{ you can add units after this };
{$IFDEF WINDOWS}{$R test.rc}{$ENDIF}
var
tcp: TIdTCPServer;
begin
tcp := TIdTCPServer.Create(nil);
tcp.ListenQueue:=1;
tcp.MaxConnections:=1;
tcp.DefaultPort:=9999;
tcp.Active:=true;
end.
При выполнении ругается на необъявленную обязательную процедуру OnExecute, но вот как ее правильно объявить - уже всю голову сломал...
- Код: Выделить всё
eevee@eevee_work ~/Projects/Lazarus/test $ ./test
An unhandled exception occurred at $0809E940 :
EIdTCPNoOnExecute : You must have an OnExecute event.
$0809E940 EIDEXCEPTION__TOSS, line 175 of IdException.pas
$0809E871 EIDEXCEPTION__IFFALSE, line 142 of IdException.pas
$08079733 TIDTCPSERVER__CHECKOKTOBEACTIVE, line 49 of IdTCPServer.pas
$08094DB4 TIDCUSTOMTCPSERVER__SETACTIVE, line 558 of IdCustomTCPServer.pas
$08048336 main, line 31 of test.lpr