示例#1
0
        public Client(ClientData clientdata, ErgometerSimulatie simulation, string comport)
        {
            this.simulation = simulation;
            bool ipIsOk = IPAddress.TryParse("127.0.0.1", out localhost);

            if (!ipIsOk)
            {
                Console.WriteLine("ip adres kan niet geparsed worden."); Environment.Exit(1);
            }

            client  = new TcpClient(localhost.ToString(), port);
            _stream = client.GetStream();
            if (_SSL)
            {
                _sslStream = new SslStream(_stream, false, new RemoteCertificateValidationCallback(ValidateCert));
                _sslStream.AuthenticateAsClient("Healthcare", null, System.Security.Authentication.SslProtocols.Tls12, false);
            }
            isConnected = true;
            if (comport != null)
            {
                ergometerCOM = new Healthcare_test.ErgometerCOM(comport, "9600");
            }

            read = new Thread(Read);
            read.Start();
            sendlogin(clientdata.username, clientdata.password);
        }