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;
            }
        }
Example #3
0
        public APCIParameters Clone()
        {
            APCIParameters copy = new APCIParameters();

            copy.k  = k;
            copy.w  = w;
            copy.t0 = t0;
            copy.t1 = t1;
            copy.t2 = t2;
            copy.t3 = t3;

            return(copy);
        }
 /// <summary>
 /// Create a new server using the provided connection parameters.
 /// </summary>
 /// <param name="parameters">Connection parameters</param>
 public Server(APCIParameters apciParameters, ApplicationLayerParameters alParameters)
 {
     this.apciParameters = apciParameters;
     this.alParameters   = alParameters;
 }
 /// <summary>
 /// Create a new server using default connection parameters
 /// </summary>
 public Server()
 {
     this.apciParameters = new APCIParameters();
     this.alParameters   = new ApplicationLayerParameters();
 }
 public Server(uint port)
 {
     this.localPort      = (int)port;
     this.apciParameters = new APCIParameters();
     this.alParameters   = new ApplicationLayerParameters();
 }