diff --git a/ErgometerServer/DoctorSessionThread.cs b/ErgometerServer/DoctorSessionThread.cs new file mode 100644 index 0000000..523af96 --- /dev/null +++ b/ErgometerServer/DoctorSessionThread.cs @@ -0,0 +1,28 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Net.Sockets; +using System.Text; +using System.Threading.Tasks; + +namespace ErgometerServer +{ + class DoctorSessionThread + { + private int session; + private TcpClient client; + private DoctorThread doctor; + + public DoctorSessionThread(int session, TcpClient client, DoctorThread doctor) + { + this.session = session; + this.client = client; + this.doctor = doctor; + } + + public void run() + { + + } + } +} diff --git a/ErgometerServer/DoctorThread.cs b/ErgometerServer/DoctorThread.cs index 1681935..2ecd930 100644 --- a/ErgometerServer/DoctorThread.cs +++ b/ErgometerServer/DoctorThread.cs @@ -1,4 +1,8 @@ -using System.Net.Sockets; +using System.Collections; +using System.Net.Sockets; +using System.Runtime.Remoting.Lifetime; +using System.Threading; +using ErgometerLibrary; namespace ErgometerServer { @@ -8,7 +12,7 @@ namespace ErgometerServer Server server; string name; - int session; + ArrayList threads; bool running; bool loggedin; @@ -19,14 +23,30 @@ namespace ErgometerServer this.client = client; this.server = server; this.name = "Unknown"; - this.session = 0; + this.threads = new ArrayList(); this.running = false; this.loggedin = false; } public void run() { + running = true; + loggedin = true; + while (loggedin && running) + { + if (threads.Count < server.clients.Count) + { + DoctorSessionThread dt = new DoctorSessionThread(1, client, this); + threads.Add(dt); + Thread thread = new Thread(new ThreadStart(dt.run)); + thread.Start(); + } + } + } + public void logout() + { + loggedin = false; } } } \ No newline at end of file diff --git a/ErgometerServer/ErgometerServer.csproj b/ErgometerServer/ErgometerServer.csproj index c1a39b9..93b739f 100644 --- a/ErgometerServer/ErgometerServer.csproj +++ b/ErgometerServer/ErgometerServer.csproj @@ -47,6 +47,7 @@ + diff --git a/ErgometerServer/Server.cs b/ErgometerServer/Server.cs index 5fa1e0f..a584943 100644 --- a/ErgometerServer/Server.cs +++ b/ErgometerServer/Server.cs @@ -17,7 +17,7 @@ namespace ErgometerServer new Server(); } - private List clients; + public List clients { get; } private DoctorThread doctor; public Server() @@ -72,5 +72,15 @@ namespace ErgometerServer Thread thread = new Thread(new ThreadStart(doctor.run)); thread.Start(); } + + public void sendToDoctor() + { + + } + + public void sendToClient(int session) + { + + } } }