Delphi Service to Listen to TCP or UDP -


reading question: delphi windows service design, saw designer use code below in onexecute of tservice or in tthread method, in order keep service alive.

while not terminated begin   // end; 

but if need (and do) create service respond (using indy) messages sent main application in order send authentication data, do code, ignore or put sleep() in it?

indy's tidtcpserver , tidudpserver components multi-threaded, don't need use tservice.onexecute event @ all. activate them in tservice.onstart event , deactivate them in tservice.onstop event, , assign handlers tidtcpserver.onexecute , tidudpserver.onudpread events needed. both events looped you, don't need while not terminated loop in them. read/process 1 request needed, exit, , wait next event repeat. let server handle exceptions raised. , keep in mind tidudpserver has threadedevent property false default, should set true inside service.


Comments

Popular posts from this blog

php - get table cell data from and place a copy in another table -

javascript - Mootools wait with Fx.Morph start -

php - Navigate throught databse rows -