#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.C" ; =============================================================================================================================== ; Description ...: This is the client side of the pipe demo ; Author ........: Paul Campbell (PaulIA) ; Notes .........: ; =============================================================================================================================== ; =============================================================================================================================== ; Global variables ; =============================================================================================================================== ; =============================================================================================================================== ; Main ; =============================================================================================================================== Main() ; =============================================================================================================================== ; MsgLoop ; =============================================================================================================================== Func Main() Local $sData ; Local $dType ; Local $iFD Local $nLoops = 1 ; Local $sServerData = FileRead("c:\temp\ServerData.txt") ; Local $sClientData = FileRead("c:\temp\ClientData.txt") ; Local $iServerLen = StringLen($sServerData) Local $iClientLen = StringLen($sClientData) If $CmdLine[0] = 0 Then $dType = "" ; ElseIf $CmdLine[0] = 1 Then $dType = $CmdLine[1] ; ElseIf $CmdLine[0] = 2 Then $dType = $CmdLine[1] ; $nLoops = $CmdLine[2] ; EndIf Debug("Read Server Data in " & $iServerLen) Debug("Read Client Data in " & $iClientLen) Debug("Client PID:" & @AutoItPID) ; Local $Test Local $iRead Local $TimeStart $iFD = OpenConnection($dType) If ($iFD > 0) Then ConsoleWrite("Open Connection Type:" & $TypeStr[$CArray[$iFD][$C_Type]] & @CRLF) $TimeStart = TimerInit() ; Do If (WriteData($iFD, $sClientData) < 0) Then CloseConnection($iFD) Exit EndIf $iRead = ReadData($iFD, $sData) = -2 If ($iRead = -1) Then CloseConnection($iFD) Exit EndIf $Test = StringCompare($sServerData, $sData) If ($Test <> 0) Then Debug("Data do not Match") ; ConsoleWrite("ServerData:" & StringLen($sServerData) & @CRLF) ConsoleWrite("Data:" & StringLen($sData) & @CRLF) Else Debug("Data is Good") ; ConsoleWrite("Data is Good" & @CRLF) ; EndIf $nLoops -= 1 ; Until $nLoops < 1 ; $sData = "QUIT" If (WriteData($iFD, $sData) < 0) Then CloseConnection($iFD) Exit EndIf Debug("Last Packet was:" & StringLeft($sData, $MaxDataPrint)) ;$sData) Local $TimeEnd = TimerDiff($TimeStart) ; Local $Secs = $TimeEnd / 1000 ; ConsoleWrite(@CRLF & @CRLF & "Test for " & $TypeStr[$CArray[$iFD][$C_Type]] & " Took " & $Secs & @CRLF & @CRLF) ; FileWriteLine("timing.csv", $TypeStr[$CArray[$iFD][$C_Type]] & ", " & $BUFSIZE & ", " & $iClientLen + $iServerLen & ", " & $Secs) Else ConsoleWrite("Client failed to start") ; EndIf Sleep(1000) CloseConnection($iFD) EndFunc ;==>Main