﻿using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Net.Sockets;
using System.Text;
using System.Threading;
using System.Threading.Tasks;

namespace Tenrec
{
    public class ClientConnection
    {
        private Thread delegateThread;
        private TcpClient clientConnection;
        private StreamReader clientReader;
        private StreamWriter clientWriter;

        public ClientConnection(TcpClient clientConnection)
        {
            this.clientConnection = clientConnection;
            this.delegateThread = new Thread(new ParameterizedThreadStart(HandleClient));
            this.delegateThread.Start(this.clientConnection);
        }
        public void HandleClient(object clientRef)
        {
            clientWriter = new StreamWriter(this.clientConnection.GetStream(), Encoding.UTF8);
            clientReader = new StreamReader(this.clientConnection.GetStream(), Encoding.UTF8);

            string handShakeData = null;
            handShakeData = clientReader.ReadLine();

            bool connected = true;
            while(connected)
            {
                ReadClient();
            }
        }

        public void ReadClient()
        {

        }


    }
}
