protected ProtocolBase(byte windowSize, int timeout, int ackTimeout, string fileName, ActorType actorType, ITransmissionSupport transmissionSupport) { _transmissionSupport = transmissionSupport; _MAX_SEQ = (byte)(windowSize - 1); _timeout = timeout; _fileName = fileName; _networkLayerEnable = false; _timers = new Dictionary <int, System.Timers.Timer>(_MAX_SEQ); _timerAck = new System.Timers.Timer(ackTimeout); _timerAck.Elapsed += OnTimedEventAck; _timerAck.AutoReset = false; _actorType = actorType; _lock = new object(); // Creates events that trigger the thread changing CreateMandatoryEvents(); }
public GoBacknProtocol(byte windowSize, int timeout, int ackTimeout, string fileName, ActorType actorType, ITransmissionSupport transmissionSupport) : base(windowSize, timeout, ackTimeout, fileName, actorType, transmissionSupport) { _communicationThread = new Thread(Protocol); _communicationThread.Start(); Console.WriteLine( string.Format("Started the data link layer thread of the {0} (Thread Id: {1})", actorType, _communicationThread.ManagedThreadId)); }
public SelectiveRepeatProtocol(byte windowSize, int timeout, int ackTimeout, string fileName, ActorType actorType, ITransmissionSupport transmissionSupport) : base(windowSize, timeout, ackTimeout, fileName, actorType, transmissionSupport) { _NR_BUFS = (byte)((_MAX_SEQ + 1) / 2); _no_nak = true; _oldest_frame = (byte)(_MAX_SEQ + 1); _communicationThread = new Thread(Protocol); _communicationThread.Start(); Console.WriteLine(string.Format("Started the data link layer thread of the {0} (Thread Id: {1})", actorType, _communicationThread.ManagedThreadId)); }