/// <summary>
        /// Expect a SUT control response message
        /// </summary>
        /// <param name="timeout">Time out</param>
        /// <param name="requestId">RequestId should be in the response message</param>
        /// <returns>SUT Control response message</returns>
        public SUT_Control_Response_Message ExpectSUTControlResponseMessage(TimeSpan timeout, ushort requestId)
        {
            List <byte> receivedDataList = new List <byte>();
            int         bufferLength     = 2000;
            DateTime    End = DateTime.Now + timeout;
            SUT_Control_Response_Message responseMessage = new SUT_Control_Response_Message();

            while (DateTime.Now < End)
            {
                byte[] buffer = new byte[bufferLength];

                int readbyteNumber = 0;
                do
                {
                    readbyteNumber = netDataStream.Read(buffer, 0, bufferLength);
                    if (readbyteNumber > 0)
                    {
                        byte[] tmpbuffer = new byte[readbyteNumber];
                        Array.Copy(buffer, tmpbuffer, readbyteNumber);
                        receivedDataList.AddRange(tmpbuffer);
                    }
                }while (readbyteNumber == bufferLength);

                int index = 0;
                if (responseMessage.Decode(receivedDataList.ToArray(), ref index))
                {
                    if (responseMessage.requestId == requestId)
                    {
                        return(responseMessage);
                    }
                    else
                    {
                        receivedDataList.RemoveRange(0, index);
                    }
                }

                System.Threading.Thread.Sleep(100);
            }
            return(null);
        }
        /// <summary>
        /// Expect a SUT control response message
        /// </summary>
        /// <param name="timeout">Time out</param>
        /// <param name="requestId">RequestId should be in the response message</param>
        /// <returns>SUT Control response message</returns>
        public SUT_Control_Response_Message ExpectSUTControlResponseMessage(TimeSpan timeout, ushort requestId)
        {
            List<byte> receivedDataList = new List<byte>();
            int bufferLength = 2000;
            DateTime End = DateTime.Now + timeout;
            SUT_Control_Response_Message responseMessage = new SUT_Control_Response_Message();
            while (DateTime.Now < End)
            {
                byte[] buffer = new byte[bufferLength];

                int readbyteNumber = 0;
                do
                {
                    readbyteNumber = netDataStream.Read(buffer, 0, bufferLength);
                    if (readbyteNumber > 0)
                    {
                        byte[] tmpbuffer = new byte[readbyteNumber];
                        Array.Copy(buffer, tmpbuffer, readbyteNumber);
                        receivedDataList.AddRange(tmpbuffer);
                    }
                }
                while (readbyteNumber == bufferLength);

                int index = 0;
                if (responseMessage.Decode(receivedDataList.ToArray(), ref index))
                {
                    if (responseMessage.requestId == requestId)
                    {
                        return responseMessage;
                    }
                    else
                    {
                        receivedDataList.RemoveRange(0, index);
                    }
                }

                System.Threading.Thread.Sleep(100);
            }
            return null;
        }