示例#1
0
        private AckResponse InternalSendRequest(EnqRequest request)
        {
            int    getValueLength = 0;
            string getstring      = null;

            var bytes = request.GetBytes();

            socket.Receive(getbyte, 0
                           , getbyte.Length, SocketFlags.None);
            getValueLength = byteArrayDefrag(getbyte);
            getstring      = Encoding.UTF7.GetString(getbyte, 0
                                                     , getValueLength + 1);

            //this._port.Write(bytes, 0, bytes.Length);

            //Thread.VolatileWrite(ref this._lastResponse, null);
            this._lastResponse = getbyte;
            //this._ar.WaitOne(SecondsToWait);

            if (this._lastResponse == null)
            {
                throw new Exception("Cannot connect to port!");
            }

            return((AckResponse)this._lastResponse);
        }
示例#2
0
        private AckResponse InternalSendRequest(EnqRequest request)
        {
            var bytes = request.GetBytes();

            this._port.Write(bytes, 0, bytes.Length);

            Thread.VolatileWrite(ref this._lastResponse, null);
            this._ar.WaitOne(SecondsToWait);

            if (this._lastResponse == null)
            {
                throw new Exception("Cannot connect to port!");
            }

            return((AckResponse)this._lastResponse);
        }
        private AckResponse InternalSendRequest(EnqRequest request)
        {
            var bytes = request.GetBytes();
            this._port.Write(bytes, 0, bytes.Length);

            Thread.VolatileWrite(ref this._lastResponse, null);
            this._ar.WaitOne(SecondsToWait);

            if (this._lastResponse == null)
            {
                throw new Exception("Cannot connect to port!");
            }

            return (AckResponse)this._lastResponse;
        }