ErrorMsg:=CheckOptions('h','help');
if ErrorMsg='' then begin
to this (it seems strange that this creates problems, however, solves the problem mentioned above).
How do you mean strange?
You call CheckOptions and if that states the options are
valid (through an ErrorMsg) you show an exception and exit your program.
Did you mean to write?
// quick check parameters
ErrorMsg:=CheckOptions('h','help');
if ErrorMsg <> '' then begin // NOTICE the <> instead of =
ShowException(Exception.Create(ErrorMsg));
Terminate;
Exit;
end;
I'm wondering... you say this program runs on Linux and Windows. ARE YOU SURE? On those, the program would exit immediately, wouldn't it? (without changing that = to <>)
Next... you have
{ add your program here }
app:=TTCPEchoDaemon.create;
app.Execute;
// stop program loop
Terminate;
Here your thread is started and control immediately returns to the main program. That ones terminates... so all started threads also terminate (or are sent the terminate signal).
You shouldn't terminate the main program but wait for the thread to terminate before ending your program.