internal ClientConnection(Socket socket, TlsSecurityInformation tlsSecInfo, APCIParameters apciParameters, ApplicationLayerParameters parameters, Server server, ASDUQueue asduQueue, bool debugOutput)
        {
            connectionsCounter++;
            connectionID = connectionsCounter;

            this.remoteEndpoint = (IPEndPoint)socket.RemoteEndPoint;

            this.apciParameters = apciParameters;
            this.alParameters   = parameters;
            this.server         = server;
            this.asduQueue      = asduQueue;
            this.debugOutput    = debugOutput;

            ResetT3Timeout();

            maxSentASDUs   = apciParameters.K;
            this.sentASDUs = new SentASDU[maxSentASDUs];

            receivedASDUs        = new ConcurrentQueue <ASDU> ();
            waitingASDUsHighPrio = new Queue <BufferFrame> ();

            socketStream    = new NetworkStream(socket);
            this.socket     = socket;
            this.tlsSecInfo = tlsSecInfo;

            this.fileServer = new FileServer(this, server.GetAvailableFiles(), DebugLog);

            Thread workerThread = new Thread(HandleConnection);

            workerThread.Start();
        }
        public Server(APCIParameters apciParameters, ApplicationLayerParameters alParameters, TlsSecurityInformation securityInfo)
        {
            this.apciParameters = apciParameters;
            this.alParameters   = alParameters;
            this.securityInfo   = securityInfo;

            if (securityInfo != null)
            {
                this.localPort = 19998;
            }
        }