delphi - concurrency between OS processes -
this question has answer here:
the problem over-complicated. straightforward solution redesign uwe , david suggested:
(1) worker app. (2) long-running tcpserver, awaits clients , calls workers (3) clients.
========================
i build sampleapp
functions as:
- when started, checks if there
sampleapp
running; - if not, starts
tcpserver
,tcpclient
, passes commandtcpclient
tcpserver
, work, closestcpserver
, , quits; - if yes, starts
tcpclient
, passes command other'stcpserver
, quits. (the other'stcpserver
work.) - there may multiple
sampleapp
started when first 1 still running.
i have no idea how solve problem practically, example :
- which architecture start ? ( reputed omnithreadlibrary seems deal thread-based concurrency instead of os-process-based concurrency. )
- there no
sampleapp
running. 2sampleapp
started (almost) simultaneously. how guarantee 1 tcpserver started? (there no "global list" register incoming "players".) - there 1
sampleapp
running. how handle if 2nd detects 1st's mutex , decides tcpclient, 1st stops tcpserver , quits?
any insights appreciated!
if want use communicate between processes on single computer (in single user session), should @ activex automation objects. creating com object uses localserver starting , stopping of 'server' process you.
see more here: http://docwiki.embarcadero.com/radstudio/xe4/en/creating_an_active_server_object
in case insist on using ttcpserver, when 2 processes start (almost) simultaneously, still 1 allowed bind tcp port, , other exception when calling listen on ttcpserver.
Comments
Post a Comment