From 54749b4012cddd9e80f26971dcf45fc352aead26 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ricco=20Mandahl=20J=C3=B8rgensen?= Date: Tue, 13 Mar 2018 12:53:24 +0100 Subject: First Commit --- .../PasswordCrackerServer/clientConnection.cs | 41 ++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 PasswordCrackerDistributed/PasswordCrackerServer/clientConnection.cs (limited to 'PasswordCrackerDistributed/PasswordCrackerServer/clientConnection.cs') diff --git a/PasswordCrackerDistributed/PasswordCrackerServer/clientConnection.cs b/PasswordCrackerDistributed/PasswordCrackerServer/clientConnection.cs new file mode 100644 index 0000000..ee086e1 --- /dev/null +++ b/PasswordCrackerDistributed/PasswordCrackerServer/clientConnection.cs @@ -0,0 +1,41 @@ +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Net.Sockets; +using System.Text; +using System.Threading.Tasks; + +namespace PasswordCrackerServer +{ + class clientConnection + { + public TcpClient connectionSocket { get; set; } + public string chunk { get; set; } + + public string pass { get; set; } + + + public clientConnection(TcpClient connectionSocket, string chunk, string pass) + { + this.connectionSocket = connectionSocket; + this.chunk = chunk; + this.pass = pass; + } + + public async Task Doit() + { + Stream ns = connectionSocket.GetStream(); + StreamReader sr = new StreamReader(ns); + + StreamWriter sw = new StreamWriter(ns); + sw.AutoFlush = true; + + sw.WriteLine($"DPCP 1.0\n{pass}\n{chunk}"); + //sw.WriteLine(pass); + //sw.WriteLine(chunk); + + return sr.ReadLine(); + } + } +} -- cgit v1.2.3