aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormarcinzelent <zelent.marcin@gmail.com>2018-03-17 15:33:00 +0100
committermarcinzelent <zelent.marcin@gmail.com>2018-03-17 15:33:00 +0100
commitf68bb1864b40c69d12b44db5aa33125aef39e150 (patch)
treebb11f3714a2aa99708f5cca2feec3ff68d3e5b88 /DistributedPasswordCracker.Server/Models/ClientConnection.cs
parent7e2a8dbd051b94115672cf22cc66ef09ba8376ca (diff)
Restructuring
Diffstat (limited to 'DistributedPasswordCracker.Server/Models/ClientConnection.cs')
-rw-r--r--DistributedPasswordCracker.Server/Models/ClientConnection.cs37
1 files changed, 37 insertions, 0 deletions
diff --git a/DistributedPasswordCracker.Server/Models/ClientConnection.cs b/DistributedPasswordCracker.Server/Models/ClientConnection.cs
new file mode 100644
index 0000000..4dab2b1
--- /dev/null
+++ b/DistributedPasswordCracker.Server/Models/ClientConnection.cs
@@ -0,0 +1,37 @@
+using System.IO;
+using System.Net.Sockets;
+using System.Threading.Tasks;
+
+namespace DistributedPasswordCracker.Server.Models
+{
+ 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)
+ {
+ ConnectionSocket = connectionSocket;
+ Chunk = chunk;
+ Pass = pass;
+ }
+
+ public async Task<string> SendToClient()
+ {
+ Stream ns = ConnectionSocket.GetStream();
+ StreamReader sr = new StreamReader(ns);
+ StreamWriter sw = new StreamWriter(ns)
+ {
+ AutoFlush = true
+ };
+
+ sw.WriteLine($"DPCP 1.0\n{Pass}\n{Chunk}\n\n");
+ //sw.WriteLine(pass);
+ //sw.WriteLine(chunk);
+
+ return sr.ReadLine();
+ }
+ }
+} \ No newline at end of file