Usually you will create a loop listening for signals after instantiating the listening thread.
collex.lpr
==========================
uses main;
begin
TTCPEchoDaemon.create; //readln;
end.
========
I am trying to develop a console app which listens for information on a network (using synapse) and put's it into a database. I am having difficulty get the app to stay open and listen for traffic. I have tried using the echo demo. I have tried adding 'readln' but I still can not get 'echo' to listen.What should I do?
Find the following snippets of code:collex.lpr
==========================
uses main;
begin
TTCPEchoDaemon.create; //readln;
end.
=========================main.pas
========================
Constructor TTCPEchoDaemon.Create;
begin
sock:=TTCPBlockSocket.create;
FreeOnTerminate:=true;
inherited create(false);
end;Destructor TTCPEchoDaemon.Destroy;
begin
Sock.free;
end;procedure TTCPEchoDaemon.Execute;
var
ClientSock:TSocket;
begin
with sock do
begin
CreateSocket;
setLinger(true,10);
bind('0.0.0.0','4515');
listen;
repeat
if terminated then break;
if canread(1000) then
begin
ClientSock:=accept;
if lastError=0 then TTCPEchoThrd.create(ClientSock);
end;
until false;
end;
end;
==============================
Any Ideas
-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
synalist-public mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/synalist-public
------------------------------------------------------------------------- Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________ synalist-public mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/synalist-public
