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 command tcpclient tcpserver, work, closes tcpserver, , quits;
  • if yes, starts tcpclient, passes command other's tcpserver , quits. (the other's tcpserver work.)
  • there may multiple sampleapp started when first 1 still running.

i have no idea how solve problem practically, example :

  1. which architecture start ? ( reputed omnithreadlibrary seems deal thread-based concurrency instead of os-process-based concurrency. )
  2. there no sampleapp running. 2 sampleapp started (almost) simultaneously. how guarantee 1 tcpserver started? (there no "global list" register incoming "players".)
  3. 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

Popular posts from this blog

wordpress - (T_ENDFOREACH) php error -

Export Excel workseet into txt file using vba - (text and numbers with formulas) -

Using django-mptt to get only the categories that have items -