Hi Robin,

i had the same problem long time ago, so i'm not sure if i remember correctly.

The solution might be:

Constructor TTCPEchoDaemon.Create;
begin
 sock:=TTCPBlockSocket.create;
 FreeOnTerminate:=true;

 inherited create(false); <<<-------  Put the inherited line at the end
end;

I think on free pascal the thread starts immediately after the inherited call (if the resume parameter is false),
in Delphi the thread starts after the constructor is completely done.

I'm always create the thread with suspend = true and start the explicit with a resume call.

Alex



Robin Cumming schrieb:
I have set up Lazarus Freepascal on Ubuntu 9.10 and
compiled the EchoSrv demo in Synapse39. The program is
aborting and exiting when the Echo Daemon is created as
follows :

Constructor TTCPEchoDaemon.Create;
begin
inherited create(false); ------->>> fails here
sock:=TTCPBlockSocket.create;
FreeOnTerminate:=true;
end;

That's because under linux you have to explicitly use a
thread manager.
Just add cthreads to the use clause of the dpr file.
Then, if you're not running it as root, it will fail
since a normal user cannot bind to ports < 1024, so
you'll either have to change the port
(see in echo.pas the call to bind) or run the program as
root (inadvisable).

Bye
--
Luca

APOLOGIES FOR DUPLICATE POST - FORGOT SUBJECT LINE.

Thanks Luca, have set the port to 9099 and ensured cthreads
is declared in all units. However still fails on "inherited
create(false)" statement as above. I am running Ubuntu
within VirtualBox on Windows XP, perhaps this may causing
the problem ?

Thanks
Rob


_______________________________________________________________________________________
"EAST RAND SECURITY EXPO NOW ON"


http://www.swiftsms.co.za/swiftT/track.asp?e=*em*&cid=113&u=8&tid=2011


------------------------------------------------------------------------------
Join us December 9, 2009 for the Red Hat Virtual Experience,
a free event focused on virtualization and cloud computing. Attend in-depth sessions from your desk. Your couch. Anywhere.
http://p.sf.net/sfu/redhat-sfdev2dev
_______________________________________________
synalist-public mailing list
synalist-public@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/synalist-public


------------------------------------------------------------------------------
Join us December 9, 2009 for the Red Hat Virtual Experience,
a free event focused on virtualization and cloud computing. 
Attend in-depth sessions from your desk. Your couch. Anywhere.
http://p.sf.net/sfu/redhat-sfdev2dev
_______________________________________________
synalist-public mailing list
synalist-public@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/synalist-public

Reply via email to