#Region ;**** Directives created by AutoIt3Wrapper_GUI **** #AutoIt3Wrapper_Change2CUI=y #AutoIt3Wrapper_Run_Tidy=y #AutoIt3Wrapper_Run_Au3Stripper=y #Au3Stripper_Parameters=/mo #EndRegion ;**** Directives created by AutoIt3Wrapper_GUI **** #include $debug_filename = "c:\temp\A2C_debug.S" ; =============================================================================================================================== ; Description ...: This is the server side of the pipe demo ; Author ........: Paul Campbell (PaulIA) ; Notes .........: ; =============================================================================================================================== ; =============================================================================================================================== ; Main ; =============================================================================================================================== Main() ; =============================================================================================================================== ; This function loops waiting for a connection event or the app to close ; =============================================================================================================================== Func Main() Local $dType Local $sData, $sReply ; Local $ReadResult Local $iFD If $CmdLine[0] = 0 Then $dType = "" ; Else $dType = $CmdLine[1] ; EndIf Local $sServerData = FileRead("c:\temp\ServerData.txt") ; Local $sClientData = FileRead("c:\temp\ClientData.txt") ; Debug("Read Server Data in " & StringLen($sServerData)) Debug("Read Client Data in " & StringLen($sClientData)) Debug("Server PID:" & @AutoItPID) ; $iFD = InitConnection($dType) Local $Test While 1 ConsoleWrite("Starting Connection Type:" & $TypeStr[$CArray[$iFD][$C_Type]] & @CRLF) If (Not StartConnection($iFD)) Then ExitLoop EndIf While True $sData = "" $ReadResult = ReadData($iFD, $sData) If ($ReadResult < 0) Then ExitLoop ; EndIf If ($sData = "QUIT") Then Debug("Encountered " & $sData) ; ExitLoop ; EndIf $Test = StringCompare($sClientData, $sData) If ($Test <> 0) Then Debug("Data do not Match") ; ;Debug("ClientData:" & StringLeft($sClientData, $MaxDataPrint)) ; ConsoleWrite("ClientData:" & StringLen($sClientData) & @CRLF) ;Debug("Data:" & StringLeft($sData, $MaxDataPrint)) ; ConsoleWrite("Data:" & StringLen($sData) & @CRLF) Else Debug("Data is Good") ; Debug("Data:" & StringLeft($sData, $MaxDataPrint)) ; Debug("ClientData:" & StringLeft($sClientData, $MaxDataPrint)) ; ConsoleWrite("Data is Good" & @CRLF) ; EndIf ; Execute the console command ;ExecuteCmd($sData) If (WriteData($iFD, $sServerData) < 0) Then ExitLoop ; EndIf WEnd StopConnection($iFD) ; WEnd EndConnection($iFD) EndFunc ;==>Main ; =============================================================================================================================== ; Executes a command and returns the results ; =============================================================================================================================== Func ExecuteCmd(ByRef $sData) Debug("Received:" & $sData & @CRLF & " Replying") ; EndFunc ;==>ExecuteCmd