added a bit of security to chat server

This commit is contained in:
princessbobsanta 2016-03-22 14:51:25 -10:00
parent 17355e9bcc
commit f76bd77cd7
13 changed files with 32 additions and 5 deletions

View File

@ -34,6 +34,7 @@ namespace GameCreatorGroupProject
y = yspawn; y = yspawn;
} }
} }
//Update should check for user input at the start or end of each frame.a //Update should check for user input at the start or end of each frame.a
void Update() { void Update() {
//get state of all keyboards on device //get state of all keyboards on device

View File

@ -52,3 +52,18 @@ C:\Users\Jared\Documents\GitHub\mod4\GameCreatorGroupProject\GameCreatorGroupPro
C:\Users\Jared\Documents\GitHub\mod4\GameCreatorGroupProject\GameCreatorGroupProject\obj\Debug\GameCreatorGroupProject.MainWindow.resources C:\Users\Jared\Documents\GitHub\mod4\GameCreatorGroupProject\GameCreatorGroupProject\obj\Debug\GameCreatorGroupProject.MainWindow.resources
C:\Users\Jared\Documents\GitHub\mod4\GameCreatorGroupProject\GameCreatorGroupProject\obj\Debug\GameCreatorGroupProject.Properties.Resources.resources C:\Users\Jared\Documents\GitHub\mod4\GameCreatorGroupProject\GameCreatorGroupProject\obj\Debug\GameCreatorGroupProject.Properties.Resources.resources
C:\Users\Jared\Documents\GitHub\mod4\GameCreatorGroupProject\GameCreatorGroupProject\obj\Debug\GameCreatorGroupProject.csproj.GenerateResource.Cache C:\Users\Jared\Documents\GitHub\mod4\GameCreatorGroupProject\GameCreatorGroupProject\obj\Debug\GameCreatorGroupProject.csproj.GenerateResource.Cache
C:\Users\Jared\Documents\GitHub\mod5\GameCreatorGroupProject\GameCreatorGroupProject\bin\Debug\GameCreatorGroupProject.exe.config
C:\Users\Jared\Documents\GitHub\mod5\GameCreatorGroupProject\GameCreatorGroupProject\obj\Debug\GameCreatorGroupProject.exe
C:\Users\Jared\Documents\GitHub\mod5\GameCreatorGroupProject\GameCreatorGroupProject\obj\Debug\GameCreatorGroupProject.pdb
C:\Users\Jared\Documents\GitHub\mod5\GameCreatorGroupProject\GameCreatorGroupProject\bin\Debug\GameCreatorGroupProject.exe
C:\Users\Jared\Documents\GitHub\mod5\GameCreatorGroupProject\GameCreatorGroupProject\bin\Debug\GameCreatorGroupProject.pdb
C:\Users\Jared\Documents\GitHub\mod5\GameCreatorGroupProject\GameCreatorGroupProject\bin\Debug\OpenTK.Compatibility.dll
C:\Users\Jared\Documents\GitHub\mod5\GameCreatorGroupProject\GameCreatorGroupProject\bin\Debug\OpenTK.dll
C:\Users\Jared\Documents\GitHub\mod5\GameCreatorGroupProject\GameCreatorGroupProject\bin\Debug\OpenTK.GLControl.dll
C:\Users\Jared\Documents\GitHub\mod5\GameCreatorGroupProject\GameCreatorGroupProject\bin\Debug\OpenTK.pdb
C:\Users\Jared\Documents\GitHub\mod5\GameCreatorGroupProject\GameCreatorGroupProject\bin\Debug\OpenTK.xml
C:\Users\Jared\Documents\GitHub\mod5\GameCreatorGroupProject\GameCreatorGroupProject\bin\Debug\OpenTK.GLControl.xml
C:\Users\Jared\Documents\GitHub\mod5\GameCreatorGroupProject\GameCreatorGroupProject\obj\Debug\GameCreatorGroupProject.csprojResolveAssemblyReference.cache
C:\Users\Jared\Documents\GitHub\mod5\GameCreatorGroupProject\GameCreatorGroupProject\obj\Debug\GameCreatorGroupProject.MainWindow.resources
C:\Users\Jared\Documents\GitHub\mod5\GameCreatorGroupProject\GameCreatorGroupProject\obj\Debug\GameCreatorGroupProject.Properties.Resources.resources
C:\Users\Jared\Documents\GitHub\mod5\GameCreatorGroupProject\GameCreatorGroupProject\obj\Debug\GameCreatorGroupProject.csproj.GenerateResource.Cache

View File

@ -71,15 +71,23 @@ namespace Server_application
if (listener.Pending() && currentID == serverID) if (listener.Pending() && currentID == serverID)
{ {
//connects to client //connects to client
//currently connects to any client, possibly add security later
TcpClient client = listener.AcceptTcpClient(); TcpClient client = listener.AcceptTcpClient();
//spawns new thread for handling data transmission to other clients //if client attempting to connect directly without going through main server, denies connection (closes clients stream)
if (!connectExpected)
{
client.GetStream().Close();
client.Close();
}
//else spawns new thread for handling data transmission to other clients
else
{
Thread t = new Thread(transmitter); Thread t = new Thread(transmitter);
t.Start(client); t.Start(client);
connectExpected = false; connectExpected = false;
} }
} }
} }
}
//sends messages to all clients //sends messages to all clients
private void transmitter(Object client) private void transmitter(Object client)

View File

@ -18,3 +18,6 @@ H:\mod3\Server application\Server application\obj\Debug\Server_application.Prope
H:\mod3\Server application\Server application\obj\Debug\Server application.csproj.GenerateResource.Cache H:\mod3\Server application\Server application\obj\Debug\Server application.csproj.GenerateResource.Cache
H:\mod3\Server application\Server application\obj\Debug\Server application.exe H:\mod3\Server application\Server application\obj\Debug\Server application.exe
H:\mod3\Server application\Server application\obj\Debug\Server application.pdb H:\mod3\Server application\Server application\obj\Debug\Server application.pdb
C:\Users\Jared\Documents\GitHub\mod5\Server application\Server application\bin\Debug\Server application.exe.config
C:\Users\Jared\Documents\GitHub\mod5\Server application\Server application\obj\Debug\Server application.exe
C:\Users\Jared\Documents\GitHub\mod5\Server application\Server application\obj\Debug\Server application.pdb