diff --git a/ErgometerServer/ClientThread.cs b/ErgometerServer/ClientThread.cs
index 1460881..e0cde8c 100644
--- a/ErgometerServer/ClientThread.cs
+++ b/ErgometerServer/ClientThread.cs
@@ -75,7 +75,6 @@ namespace ErgometerServer
{
name = input.DisplayName;
loggedin = true;
- Console.WriteLine(name + " (client) connected with password: " + input.Password);
FileHandler.CreateSession(session, name);
}
}
@@ -95,7 +94,6 @@ namespace ErgometerServer
{
chat.Add(new ChatMessage(name, input.ChatMessage, false));
server.SendToDoctor(input);
- Console.WriteLine(name + ": " + input.ChatMessage);
}
else
NetHelper.SendNetCommand(client, new NetCommand(NetCommand.ResponseType.NOTLOGGEDIN, session));
@@ -108,8 +106,17 @@ namespace ErgometerServer
FileHandler.WriteChat(session, chat);
client.Close();
break;
+ case NetCommand.CommandType.ERROR:
+ Console.WriteLine("An error occured, assuming client disconnected");
+ loggedin = false;
+ running = false;
+ Console.WriteLine(name + " logged out due to an error");
+ FileHandler.WriteMetingen(session, metingen);
+ FileHandler.WriteChat(session, chat);
+ client.Close();
+ break;
default:
- throw new FormatException("Unknown command");
+ throw new FormatException("Unknown command");
}
}
diff --git a/ErgometerServer/DoctorThread.cs b/ErgometerServer/DoctorThread.cs
index 2dc6a40..f3ed1a4 100644
--- a/ErgometerServer/DoctorThread.cs
+++ b/ErgometerServer/DoctorThread.cs
@@ -100,6 +100,12 @@ namespace ErgometerServer
throw new FormatException("Unknown Command");
}
+ break;
+ case NetCommand.CommandType.ERROR:
+ Console.WriteLine("An error occured, assuming docter disconnected");
+ running = false;
+ Console.WriteLine("Doctor logged out due to an error");
+ client.Close();
break;
default:
throw new FormatException("Unknown Command");
diff --git a/ErgometerServer/ErgometerServer.csproj b/ErgometerServer/ErgometerServer.csproj
index 03ff5a0..67b48bc 100644
--- a/ErgometerServer/ErgometerServer.csproj
+++ b/ErgometerServer/ErgometerServer.csproj
@@ -37,6 +37,10 @@
False
..\..\..\ErgometerLibrary\ErgometerLibrary\ErgometerLibrary\bin\Debug\ErgometerLibrary.dll
+
+ ..\packages\Newtonsoft.Json.7.0.1\lib\net45\Newtonsoft.Json.dll
+ True
+
@@ -49,11 +53,13 @@
+
+