* ** MtgSvrMain * ** Main or 'start' program for Mortgage Server Service * SET TALK OFF SET NOTIFY OFF SET EXCLUSIVE OFF SET PROCEDURE TO wwapi.prg, wwutils.prg ADDITIVE LOCAL lnMilliseconds, lnSleepSeconds, lnNtService, loIP IF FILE("seconds.txt") lnSleepSeconds = FILETOSTR("seconds.txt") ENDIF IF ISDIGIT(lnSleepSeconds) lnSleepSeconds = INT(VAL(lnSleepSeconds)) ELSE STORE 15 TO lnSleepSeconds ENDIF STORE lnSleepSeconds * 1000 TO lnMilliseconds * ** Service Support * STORE 0 TO lnNtService && 1 = Disables Service Mode, 0 enables it =SYS(2340,lnNtService) && VFP 7.0 function - You will need VFP 7.0 for this! SET CLASSLIB TO wwipstuff && Web Connection Internet Library. * ** Create wwIpStuff Object * loIP = CREATEOBJECT("wwIpStuff") =WriteLog(PROGRAM(),"Starting Up") IF VARTYPE(loIP) == "O" * ** Set up Sleep Mode * DECLARE Sleep IN WIN32API INTEGER lnMilliseconds && Make Windows API Sleep function available. CLEAR TYPEAHEAD IF LocalFileCheck() && Checks for and creates any necessary tables. IF TokenPass() && Process to actually exchange data with Transaction Server. && Validates if TS is 'live'. DO WHILE .T. ServerReceive(loIP) && Receive loacally any Transaction Server-based data. ServerSend(loIP) && Send any local data to Transaction Server. =Sleep(lnMilliseconds) && Pause for 'n' seconds. IF FILE("stop.txt") OR CHRSAW() && Back door way to stop service. EXIT ENDIF ENDDO ELSE =WriteLog(PROGRAM(),"Token Pass Failed") ENDIF ENDIF ENDIF =WriteLog(PROGRAM(),"Shutting Down")