Added logging. All information will be written to chime_network.log. Feel free to add more logging if you want.

daa82 [2002-11-25 03:35:10]
Added logging. All information will be written to chime_network.log. Feel free to add more logging if you want.
Filename
client94/ChimeSystemDriver.cpp
client94/InfoStorer.cpp
client94/InfoStorer.h
client94/chimeClient.sln
client94/comm_client/SienaPublisher.cpp
client94/comm_client/SienaSubscriber.cpp
client94/comm_client/UDPClient.cpp
client94/comm_client/UDPServer.cpp
client94/debug.txt
diff --git a/client94/ChimeSystemDriver.cpp b/client94/ChimeSystemDriver.cpp
index 445e266..7705390 100644
--- a/client94/ChimeSystemDriver.cpp
+++ b/client94/ChimeSystemDriver.cpp
@@ -68,8 +68,8 @@ CS_IMPLEMENT_APPLICATION
 SCF_REGISTER_STATIC_LIBRARY (engine)
 #endif

-//-----------------------------------------------------------------------------

+//-----------------------------------------------------------------------------
 //this is the method we register with the registry
 static bool ChimeHandleEvent(iEvent& ev) {

@@ -87,14 +87,6 @@ static bool ChimeHandleEvent(iEvent& ev) {
 		return Sys ? Sys->HandleEvent(ev): false;
 }

-//Shutdown the engine.
-/*
-void Cleanup()
-{
-	System->console_out ("Cleaning up...\n");
-	delete System;
-}
-*/

 ChimeSystemDriver::ChimeSystemDriver()
 {
diff --git a/client94/InfoStorer.cpp b/client94/InfoStorer.cpp
index 5a0d866..c27186e 100644
--- a/client94/InfoStorer.cpp
+++ b/client94/InfoStorer.cpp
@@ -18,28 +18,35 @@

 //setup internal things
 InfoStorer::InfoStorer() {
-  //siena port
-  siena_port = NULL;
-
-  //chat port to use
-  chat_port = NULL;
-
-  //client communications object
-  comm_object = NULL;
-
-  //set the ip address of this machine
-  SetMyIPAddress(GetLocalIP());
+
+  siena_port = NULL;			//siena port
+  chat_port = NULL;				//chat port to use
+  comm_object = NULL;			//client communications object
+  SetMyIPAddress(GetLocalIP());	//set the ip address of this machine

   strcpy(username, "");
-
   strcpy(password, "");
-
   strcpy(siena_location, "");
+  log_file.open("chime_network.log");

   //create the Mutex object the first time we create this class
   mutex=CreateMutex(NULL,FALSE,NULL); // create a mutex object with no name
 }

+void InfoStorer::AddToLog(const char *system, const char *message) {
+	char finalmsg[2048];
+	__time64_t ltime;
+
+	sprintf(finalmsg, "\n---------\nSystem: %s\nTime Now: %s\nMessage: %s\n*********\n", system, _ctime64(&ltime), message);
+	if (log_file.is_open())
+		log_file.write(finalmsg, strlen(finalmsg));
+}
+
+void InfoStorer::CloseLog() {
+	if (log_file.is_open())
+		log_file.close();
+}
+
 //get the communication object
 ClientComm* InfoStorer::GetCommObject() {
 	return comm_object;
diff --git a/client94/InfoStorer.h b/client94/InfoStorer.h
index c10b4ea..97173d4 100644
--- a/client94/InfoStorer.h
+++ b/client94/InfoStorer.h
@@ -8,6 +8,8 @@
 #ifndef __INFOSTORER_H_
 #define __INFOSTORER_H_

+#include <fstream.h>
+#include <time.h>
 //forward declarations
 class ClientComm;

@@ -17,77 +19,45 @@ class InfoStorer {
 //will keep this in the back of my head for now
 private:

-  //the username
-  char username[50];
-
-  //the password
-  char password[50];
+  char username[50];		//the username
+  char password[50];		//the password
+  char siena_location[50];	//siena location
+  int siena_port;			//siena port
+  int chat_port;			//chat port to use
+  char ip_address[50];		//ip_address of this machine
+  ClientComm *comm_object;	//communication object
+  ofstream log_file;		//init the log file

-  //siena location
-  char siena_location[50];
-
-  //siena port
-  int siena_port;
-
-  //chat port to use
-  int chat_port;
-
-  //ip_address of this machine
-  char ip_address[50];
-
-  //communication object
-  ClientComm *comm_object;
-
-  // Create a Mutex object
-  volatile HANDLE mutex;
+  volatile HANDLE mutex;	// Create a Mutex object

 public:
-	//setup internal things
-	InfoStorer::InfoStorer();
-
-	//get the client comm object
-	ClientComm* GetCommObject();
-
-	//set the communications object
-	void SetCommObject(ClientComm *comm_object);
-
-	//get the username
-	void GetUsername(char *username);
-
-	//get the password
-	void GetPassword(char *password);
-
-	//return the port used to send chat commands
-	const int GetChatPort();
-
-	//get the hostname of the siena
-	void GetSienaLocation(char *siena_location);
-
-	//get the port on which Siena is listening
-	const int GetSienaPort();
-
-	//set the username
-	void SetUsername(const char *username);
-
-	//set the password
-	void SetPassword(const char *password);
-
-	//set the port used to send chat commands
-	void SetChatPort(int chat_port);
-
-	//set the hostname of the siena
-	void SetSienaLocation(const char *siena_location);
-
-	//set the port on which Siena is listening
-	void SetSienaPort(int siena_port);
-
-	//set my IP address
-	void SetMyIPAddress(char *ip_address);
-
-	//get my IP address
-	void GetMyIPAddress(char *my_address);
-
-	char* GetLocalIP();
+
+	InfoStorer();						//setup internal things
+	~InfoStorer() { CloseLog(); };		//destruct this object
+
+	//clientComm manipulation
+	ClientComm* GetCommObject();					//get the client comm object
+	void SetCommObject(ClientComm *comm_object);	//set the communications object
+
+	void GetUsername(char *username);				//get the username
+	void GetPassword(char *password);				//get the password
+	const int GetChatPort();						//return the port used to send chat commands
+
+	void GetSienaLocation(char *siena_location);	//get the hostname of the siena
+	const int GetSienaPort();						//get the port on which Siena is listening
+	void SetUsername(const char *username);			//set the username
+	void SetPassword(const char *password);			//set the password
+
+	void SetChatPort(int chat_port);				//set the port used to send chat commands
+	void SetSienaLocation(const char *siena_location);	//set the hostname of the siena
+
+	void SetSienaPort(int siena_port);				//set the port on which Siena is listening
+	void SetMyIPAddress(char *ip_address);			//set my IP address
+	void GetMyIPAddress(char *my_address);			//get my IP address
+
+	char* GetLocalIP();								//get the local IP address
+	void AddToLog(const char *system, const char *message);
+	void CloseLog();
 };

 #endif
\ No newline at end of file
diff --git a/client94/chimeClient.sln b/client94/chimeClient.sln
index e113811..d422a12 100644
--- a/client94/chimeClient.sln
+++ b/client94/chimeClient.sln
@@ -11,8 +11,8 @@ Global
 	GlobalSection(ProjectConfiguration) = postSolution
 		{205DE62D-34B4-4808-8EC0-A04455D067B4}.Debug.ActiveCfg = Debug|Win32
 		{205DE62D-34B4-4808-8EC0-A04455D067B4}.Debug.Build.0 = Debug|Win32
-		{205DE62D-34B4-4808-8EC0-A04455D067B4}.Release.ActiveCfg = Release|Win32
-		{205DE62D-34B4-4808-8EC0-A04455D067B4}.Release.Build.0 = Release|Win32
+		{205DE62D-34B4-4808-8EC0-A04455D067B4}.Release.ActiveCfg = Debug|Win32
+		{205DE62D-34B4-4808-8EC0-A04455D067B4}.Release.Build.0 = Debug|Win32
 	EndGlobalSection
 	GlobalSection(ExtensibilityGlobals) = postSolution
 	EndGlobalSection
diff --git a/client94/comm_client/SienaPublisher.cpp b/client94/comm_client/SienaPublisher.cpp
index 9923dda..d2744ed 100644
--- a/client94/comm_client/SienaPublisher.cpp
+++ b/client94/comm_client/SienaPublisher.cpp
@@ -446,7 +446,8 @@ bool SienaPublisher::publish(int function, char *params, char *address, char *pr
 	sprintf (publishString, "%s chime_method=\"%s\"", publishString, method);
 	sprintf (publishString, "%s access=\"\"}", publishString);
 	printf("Sending: %s\n\n", publishString);
-
+	System->info->AddToLog("Siena Publish", publishString);
+
 	if (send (s, publishString, strlen(publishString), 0) == SOCKET_ERROR)
 	{
 		System->ShowError(Component, "Can't Send Publish Request");
diff --git a/client94/comm_client/SienaSubscriber.cpp b/client94/comm_client/SienaSubscriber.cpp
index 068b65c..5c0cabe 100644
--- a/client94/comm_client/SienaSubscriber.cpp
+++ b/client94/comm_client/SienaSubscriber.cpp
@@ -513,6 +513,7 @@ bool SienaSubscriber::startServer() {
 		{
 			//recvString[length] = NULL;
 			//printf("The string is: %s\n", recvString);
+			System->info->AddToLog("Siena Subscriber Received", finalString);
 			formatResponse(finalString);
 			printf ("%s\n\n", finalString);
 		}
diff --git a/client94/comm_client/UDPClient.cpp b/client94/comm_client/UDPClient.cpp
index 02c678d..e7227dd 100644
--- a/client94/comm_client/UDPClient.cpp
+++ b/client94/comm_client/UDPClient.cpp
@@ -135,6 +135,7 @@ void UDPClient::sendMess(const char *host, char *string) {
 		return;
 	}

+	System->info->AddToLog("AI2TV UDP Sending", string);
 	//free(msg);
 }

@@ -202,6 +203,7 @@ void UDPClient::sendMess(const char *host, int func, char *params) {
 		return;
 	}

+	System->info->AddToLog("UDP Sending", msg);
 	//free(msg);
 }

diff --git a/client94/comm_client/UDPServer.cpp b/client94/comm_client/UDPServer.cpp
index 89841bb..b47bfbf 100644
--- a/client94/comm_client/UDPServer.cpp
+++ b/client94/comm_client/UDPServer.cpp
@@ -64,16 +64,17 @@ void UDPServer::parseResponse(char *string) {
   //	nav->GetApp()->chatWindow->ShowMessage(string);
 	//change chatWindow to something else to re-route the debug messages
 	if (nav->myVideoPlayer && nav->myVideoPlayer->Comm->parseResponse(string)){
-
+		nav->info->AddToLog("AI2TV UDP Receive", string);
 		 return;
 	}

+	nav->info->AddToLog("UDP Receive", string);
 	char *method = strtok(string, "\t");
 	char *params = strtok(NULL, "\t");

 	if (method != NULL && params != NULL) {
 		int meth = getMethod(method);
-		if (meth != -1)
+		if (meth != -1)
 			nav->GetFunction(meth, params);
 	}
 }
@@ -158,9 +159,9 @@ int UDPServer::startServer() {
 					fprintf (stderr, "\n\nUDPServer Error: Error in Receiving\n\n");
 					closesocket (sock);
 			}
-
-
-			if (recvString != NULL) {
+
+
+				if (recvString != NULL) {
 				//nav->getFunction(recvString);
 				printf ("%s\n\n", recvString);
 				parseResponse(recvString);
diff --git a/client94/debug.txt b/client94/debug.txt
index fafc1af..5dd74f7 100644
--- a/client94/debug.txt
+++ b/client94/debug.txt
@@ -45552,3 +45552,51 @@ crystalspace.awsprefs: Could not open image file '/aws/sbup.png' on VFS!
 crystalspace.awsprefs: Could not open image file '/aws/sbdn.png' on VFS!
 crystalspace.awsprefs: Could not open image file '/aws/sbrt.png' on VFS!
 crystalspace.awsprefs: Could not open image file '/aws/sblt.png' on VFS!
+crystalspace.canvas.openglwin: Using 32 bits per pixel (16777216 color mode).
+crystalspace.canvas.openglcommon: OpenGL renderer: GDI Generic (vendor: Microsoft Corporation) version 1.1.0
+crystalspace.canvas.openglcommon: Using windowed mode at resolution 1024x968.
+crystalspace.graphics3d.opengl:   Super lightmaps: num=10 size=256x256
+crystalspace.graphics3d.opengl:   Optional Clipping: 0Pp
+crystalspace.graphics3d.opengl:   Required Clipping: 0Pp
+crystalspace.graphics3d.opengl:   Outer Clipping: PZp
+crystalspace.system: Siena Publisher
+Unable to Connect Socket to Server
+
+crystalspace.system: Siena Publisher
+Can't Setup Socket
+
+crystalspace.system: Siena Publisher
+Unable to Connect Socket to Server
+
+crystalspace.system: Siena Publisher
+Can't Setup Socket
+
+crystalspace.system: Loading AWS...
+crystalspace.awsprefs: Could not open image file '/aws/chkup.png' on VFS!
+crystalspace.awsprefs: Could not open image file '/aws/chkdn.png' on VFS!
+crystalspace.awsprefs: Could not open image file '/aws/chkon.png' on VFS!
+crystalspace.awsprefs: Could not open image file '/aws/chkoff.png' on VFS!
+crystalspace.awsprefs: Could not open image file '/aws/radup.png' on VFS!
+crystalspace.awsprefs: Could not open image file '/aws/raddn.png' on VFS!
+crystalspace.awsprefs: Could not open image file '/aws/radon.png' on VFS!
+crystalspace.awsprefs: Could not open image file '/aws/radoff.png' on VFS!
+crystalspace.awsprefs: Could not open image file '/aws/treecol.png' on VFS!
+crystalspace.awsprefs: Could not open image file '/aws/treeexp.png' on VFS!
+crystalspace.awsprefs: Could not open image file '/aws/treecol.png' on VFS!
+crystalspace.awsprefs: Could not open image file '/aws/treevl.png' on VFS!
+crystalspace.awsprefs: Could not open image file '/aws/treehl.png' on VFS!
+crystalspace.awsprefs: Could not open image file '/aws/treechke.png' on VFS!
+crystalspace.awsprefs: Could not open image file '/aws/treechkf.png' on VFS!
+crystalspace.awsprefs: Could not open image file '/aws/treegrpe.png' on VFS!
+crystalspace.awsprefs: Could not open image file '/aws/treegrpf.png' on VFS!
+crystalspace.awsprefs: Could not open image file '/aws/sbup.png' on VFS!
+crystalspace.awsprefs: Could not open image file '/aws/sbdn.png' on VFS!
+crystalspace.awsprefs: Could not open image file '/aws/sbrt.png' on VFS!
+crystalspace.awsprefs: Could not open image file '/aws/sblt.png' on VFS!
+crystalspace.engine.notify: Engine is using back2front mode.
+crystalspace.system: Siena Publisher
+Unable to Connect Socket to Server
+
+crystalspace.system: Siena Publisher
+Can't Setup Socket
+