示例#1
0
        protected internal override void Start(AsciiTcpConnection connection)
        {
            _connection = connection;
            AsciiConnectUnit connectUnit = new AsciiConnectUnit();

            connectUnit.Finished += new AsciiProtocolUnitDelegate(connectUnit_Finished);
            StartUnit(connectUnit, connection);
        }
示例#2
0
        private void connectUnit_Finished(AsciiProtocolUnit unit)
        {
            AsciiConnectUnit connectUnit = (AsciiConnectUnit)unit;

            if (!(_connected = connectUnit.Connected))
            {
                FireFinished();
            }
            else
            {
                _connection.AfterReceive    += new MethodInvoker(FireFinished);
                _connection.LineReceived    += new LineDelegate(_connection_LineReceived);
                _connection.OperationFailed += new MethodInvoker(FireFinished);
                _connection.SkipReceivedStream();
                _connection.Receive();
            }
        }