From e66efbbe8df2dd4e7de0a1e9bd129cf92e00f92f Mon Sep 17 00:00:00 2001 From: vikle012 Date: Wed, 11 Sep 2019 13:57:14 +0200 Subject: Initializes repo. --- Kod/display/ClientServerApp/Client/Client.cpp | 151 +++++++++++++++++ Kod/display/ClientServerApp/Client/Client.vcproj | 188 ++++++++++++++++++++++ Kod/display/ClientServerApp/Client/Client.vcxproj | 165 +++++++++++++++++++ 3 files changed, 504 insertions(+) create mode 100644 Kod/display/ClientServerApp/Client/Client.cpp create mode 100644 Kod/display/ClientServerApp/Client/Client.vcproj create mode 100644 Kod/display/ClientServerApp/Client/Client.vcxproj (limited to 'Kod/display/ClientServerApp/Client') diff --git a/Kod/display/ClientServerApp/Client/Client.cpp b/Kod/display/ClientServerApp/Client/Client.cpp new file mode 100644 index 0000000..efd08fe --- /dev/null +++ b/Kod/display/ClientServerApp/Client/Client.cpp @@ -0,0 +1,151 @@ +//============================================================================ +// Name : Client.cpp +// Author : Erik Hellström, hellstrom@isy.liu.se, 2008-12-14 +// Modified : Emil Larsson, lime@isy.liu.se, 2012-01-13 +// +// Description : The client requests data to be sent by the server. +// +//============================================================================ + +#include +#include +#include "ComConduit.h" + +// +// Show the command-line usage +// +void Usage(char* argv[]) { + + printf("\nUsage: %s \n\n",argv[0]); + printf(" -S= Send message, ex -S=\"hello world\".\n"); + printf(" -X Shutdown server.\n"); + printf("\n\n"); +} + + + + + +// +// Module main function +// +int main(int argc, char* argv[]) { + + // Conduit object + ComConduit Link; + // Key + KeyType key[KEY_LEN] = COM_KEY; + // Work variables + wchar_t data[COMSTR_LEN]; + bool doShutdown; + FlagType ret; + int i,j; + char c,*ptr; + WaitResult wr; + + // Initialize data + data[0] = '\0'; + doShutdown = false; + + // + // Parse the command-line. + // + for (i=1; i= COMSTR_LEN) { + fprintf(stderr,"\nToo long message.\n"); + return EXIT_FAIL; + } + data[j] = '\0'; + break; + + case 'X': + case 'x': + // Shutdown + doShutdown = true; + break; + } + } + + // Check valid args + if(!doShutdown && data[0] == '\0') { + Usage(argv); + return EXIT_FAIL; + } + + // + // Start client + // + if(!Link.StartClient(key)) { + fprintf(stderr,"StartClient() failed.\n"); + return EXIT_FAIL; + } + + ret = EXIT_OK; + if(doShutdown) { + // Tell server to shutdown + if(!Link.CauseShutdown()) { + fprintf(stderr,"\nCauseShutdown() failed.\n"); + ret = EXIT_FAIL; + } + } + else { + do { + // Check if server is ready + wr = Link.WaitForEvent(COM_READY,0); + if(wr != WAIT_OK) { + fprintf(stderr,"Server is not ready.\n"); + ret = EXIT_FAIL; + break; + } + + // Set data in shm + if(!Link.SetData(data)) { + fprintf(stderr,"SetData() failed.\n"); + ret = EXIT_FAIL; + break; + } + + // Request that the server send the data + if(!Link.CauseEvent(COM_REQUEST)) { + fprintf(stderr,"CauseEvent() failed.\n"); + ret = EXIT_FAIL; + break; + } + } while(false); + } + + // + // Shutdown + // + if(!Link.Shutdown()) { + fprintf(stderr,"Shutdown() failed.\n"); + ret = EXIT_FAIL; + } + if(ret == EXIT_OK) + fprintf(stdout, "\nClean exit.\n"); + + return ret; +} + diff --git a/Kod/display/ClientServerApp/Client/Client.vcproj b/Kod/display/ClientServerApp/Client/Client.vcproj new file mode 100644 index 0000000..dce2a22 --- /dev/null +++ b/Kod/display/ClientServerApp/Client/Client.vcproj @@ -0,0 +1,188 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Kod/display/ClientServerApp/Client/Client.vcxproj b/Kod/display/ClientServerApp/Client/Client.vcxproj new file mode 100644 index 0000000..7847220 --- /dev/null +++ b/Kod/display/ClientServerApp/Client/Client.vcxproj @@ -0,0 +1,165 @@ + + + + + Debug + Win32 + + + Debug + x64 + + + Release + Win32 + + + Release + x64 + + + + {3941DB40-83AA-41FD-A225-29B47EEFD704} + Client + Win32Proj + + + + Application + Unicode + true + + + Application + Unicode + true + + + Application + Unicode + + + Application + Unicode + + + + + + + + + + + + + + + + + + + <_ProjectFileVersion>10.0.30319.1 + $(SolutionDir)$(Configuration)\ + $(SolutionDir)$(Configuration)\ + $(Configuration)\ + $(Configuration)\ + true + true + $(SolutionDir)$(Configuration)\ + $(SolutionDir)$(Configuration)\ + $(Configuration)\ + $(Configuration)\ + false + false + + + + Disabled + ..\Common;%(AdditionalIncludeDirectories) + WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + EnableFastChecks + MultiThreadedDebugDLL + + + Level3 + EditAndContinue + + + true + Console + MachineX86 + + + + + Disabled + ..\Common;%(AdditionalIncludeDirectories) + WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) + EnableFastChecks + MultiThreadedDebugDLL + + + Level3 + ProgramDatabase + + + true + Console + + + + + MaxSpeed + true + WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) + MultiThreadedDLL + true + + + Level3 + ProgramDatabase + "..\Common";%(AdditionalIncludeDirectories) + + + true + Console + true + true + MachineX86 + + + + + MaxSpeed + true + WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) + MultiThreadedDLL + true + + + Level3 + ProgramDatabase + "..\Common";%(AdditionalIncludeDirectories) + + + true + Console + true + true + + + + + + + + {8c1e78f5-0564-498a-958d-37a997bbfe49} + false + + + + + + \ No newline at end of file -- cgit v1.2.1