aboutsummaryrefslogtreecommitdiff
blob: c99d0bed9c4b53608d9052944a8ad6ce0a32c8be (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
using System.IO;
using System.Net.Sockets;
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)
        {
            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();
        }
    }
}