File syncronization conflict on ini file with Sync framework 2.1 RRS feed

  • Question

  • Hello, 
    I use sync framework to syncronize myapp.ini configuration file on two servers ( serverA and serverB), 
    the configuration file contains many keys and it is modified many times on ServerB, 
    the synchronization process run every 5 seconds on serverA. 

    In ServerA, MyApp.exe read the key key1 from section General of myapp.ini (using api GetPrivateProfileStringA) every 30 seconds,
    and if the readed value is empty, it set value for key key2 to 'false' (using api WritePrivateProfileStringA).

    Sometimes it appens that all the keys on the myapp.ini file was lost and only key2=false is present. 

    It seems that, when myapp.ini file was modified on ServerB, the synchronization process remove the myapp,ini file from the folder on ServerA for a very short period,
    in the meantime myapp.exe try to read key1 (failing) and using the WritePrivateProfileString api, it create a new myapp.ini file with only key2. 

    How can i manage this conflict? 

    I would like that the synchronization process locks myapp.ini on serverA while it apply the changes but do not remove it from the folder, 
    so the WritePrivateProfileString  simply fail. 

    Is it possible?
    Any suggestion is welcome. 








    Monday, January 2, 2012 2:02 PM