protected SessionBase(int userId, string userName, string password, int?sendAckResponseThershold, int?receivedBytesThershold, NegotiationSetting negotiationSetting = null, TimingSetting timingSetting = null) { if (string.IsNullOrEmpty(userName)) { throw new ArgumentNullException("El nombre de usuario no puede ser una cadena vacía o nula."); } if (string.IsNullOrEmpty(password)) { throw new ArgumentNullException("La contraseña de autenticación requerida no puede ser una cadena nula o vacía."); } _password = password; CommunicationTimeout = DefaultCommunicationTimeout; AckResponseThreshold = sendAckResponseThershold ?? DefaultSendAckResponseThreshold; ReceivedBytesThreshold = receivedBytesThershold; _serviceExecutionStopwatch = new Stopwatch(); SessionStatus = SessionStatus.Closed; Phase = SessionPhase.Idle; HandshakeState = HandshakeState.Identification; dataLinkPacket = new DataLinkPacket(); Services = new List <IService>(); identificationService = new IdentificationService(); logonService = new LogonService(userId, userName); if (negotiationSetting != null) { negotiateService = new NegotiateService(negotiationSetting); } if (timingSetting != null) { timingSetupService = new TimingSetupService(timingSetting); } }
protected virtual void OnBeginHandshake() { dataLinkPacket = new Packets.DataLinkPacket(); SendToBuffer(identificationService.SendRequest()); HandshakeState = HandshakeState.Identification; }