Ejemplo n.º 1
0
        public override RequestContext ReceiveRequest(TimeSpan timeout)
        {
            if (timeout <= TimeSpan.Zero)
            {
                throw new ArgumentException(String.Format("Timeout value must be positive value. It was {0}", timeout));
            }

            DateTime start = DateTime.Now;

            // FIXME: use timeout
            if (client == null)
            {
                client = ((TcpChannelListener <IReplyChannel>)Manager).AcceptTcpClient(timeout);
            }
            NetworkStream ns = client.GetStream();

            frame = new TcpBinaryFrameManager(TcpBinaryFrameManager.SingletonUnsizedMode, ns, true)
            {
                Encoder = this.Encoder
            };

            // FIXME: use timeout
            if (!frame.ProcessPreambleRecipient())
            {
                return(null);
            }
            frame.ProcessPreambleAckRecipient();

            var msg = frame.ReadUnsizedMessage(timeout);

            // LAMESPEC: it contradicts the protocol explanation at section 3.1.1.1.1 in [MC-NMF].
            // Moving ReadEndRecord() after context's WriteUnsizedMessage() causes TCP connection blocking.
            frame.ReadEndRecord();
            return(new TcpRequestContext(this, msg));
        }
Ejemplo n.º 2
0
        protected override void OnOpen(TimeSpan timeout)
        {
            if (!is_service_side)
            {
                NetworkStream ns = client.GetStream();
                frame = new TcpBinaryFrameManager(TcpBinaryFrameManager.DuplexMode, ns, is_service_side)
                {
                    Encoder = this.Encoder,
                    Via     = this.Via
                };
                frame.ProcessPreambleInitiator();
                frame.ProcessPreambleAckInitiator();
            }
            else
            {
                // server side
                Stream s = client.GetStream();

                frame = new TcpBinaryFrameManager(TcpBinaryFrameManager.DuplexMode, s, is_service_side)
                {
                    Encoder = this.Encoder
                };

                // FIXME: use retrieved record properties in the request processing.

                frame.ProcessPreambleRecipient();
                frame.ProcessPreambleAckRecipient();
            }
        }
Ejemplo n.º 3
0
        public override RequestContext ReceiveRequest(TimeSpan timeout)
        {
            DateTime start = DateTime.Now;

            if (client == null)
            {
                return(null);
            }

            if (timeout <= TimeSpan.Zero)
            {
                throw new ArgumentException(String.Format("Timeout value must be positive value. It was {0}", timeout));
            }

            // FIXME: use timeout
            if (!frame.ProcessPreambleRecipient())
            {
                return(null);
            }
            frame.ProcessPreambleAckRecipient();

            var msg = frame.ReadUnsizedMessage(timeout);

            // LAMESPEC: it contradicts the protocol explanation at section 3.1.1.1.1 in [MC-NMF].
            // Moving ReadEndRecord() after context's WriteUnsizedMessage() causes TCP connection blocking.
            frame.ReadEndRecord();
            return(new TcpRequestContext(this, msg));
        }
Ejemplo n.º 4
0
 protected override void OnOpen(TimeSpan timeout)
 {
     // FIXME: use timeout
     frame = new TcpBinaryFrameManager(TcpBinaryFrameManager.SingletonUnsizedMode, server, true)
     {
         Encoder = this.Encoder
     };
     frame.ProcessPreambleRecipient();
     frame.ProcessPreambleAckRecipient();
 }
Ejemplo n.º 5
0
        protected override void OnOpen(TimeSpan timeout)
        {
            DateTime start = DateTime.Now;

            if (client == null)
            {
                client = ((TcpChannelListener <IReplyChannel>)Manager).AcceptTcpClient(timeout);
            }

            // FIXME: use timeout
            NetworkStream ns = client.GetStream();

            frame = new TcpBinaryFrameManager(TcpBinaryFrameManager.SingletonUnsizedMode, ns, true)
            {
                Encoder = this.Encoder, EncodingRecord = TcpBinaryFrameManager.EncodingBinary
            };
            frame.ProcessPreambleRecipient();
            frame.ProcessPreambleAckRecipient();
        }
Ejemplo n.º 6
0
		public override RequestContext ReceiveRequest (TimeSpan timeout)
		{
			if (timeout <= TimeSpan.Zero)
				throw new ArgumentException (String.Format ("Timeout value must be positive value. It was {0}", timeout));

			DateTime start = DateTime.Now;

			// FIXME: use timeout
			if (client == null)
				client = ((TcpChannelListener<IReplyChannel>) Manager).AcceptTcpClient (timeout);
			NetworkStream ns = client.GetStream ();
			frame = new TcpBinaryFrameManager (TcpBinaryFrameManager.SingletonUnsizedMode, ns, true) { Encoder = this.Encoder, EncodingRecord = TcpBinaryFrameManager.EncodingBinary };

			// FIXME: use timeout
			if (!frame.ProcessPreambleRecipient ())
				return null;
			frame.ProcessPreambleAckRecipient ();

			var msg = frame.ReadUnsizedMessage (timeout);
			// LAMESPEC: it contradicts the protocol explanation at section 3.1.1.1.1 in [MC-NMF].
			// Moving ReadEndRecord() after context's WriteUnsizedMessage() causes TCP connection blocking.
			frame.ReadEndRecord ();
			return new TcpRequestContext (this, msg);
		}
		protected override void OnOpen (TimeSpan timeout)
		{
			if (! is_service_side) {
				NetworkStream ns = client.GetStream ();
				frame = new TcpBinaryFrameManager (TcpBinaryFrameManager.DuplexMode, ns, is_service_side) {
					Encoder = this.Encoder,
					Via = this.Via };
				frame.ProcessPreambleInitiator ();
				frame.ProcessPreambleAckInitiator ();
			} else {
				// server side
				Stream s = client.GetStream ();

				frame = new TcpBinaryFrameManager (TcpBinaryFrameManager.DuplexMode, s, is_service_side) { Encoder = this.Encoder };

				// FIXME: use retrieved record properties in the request processing.

				frame.ProcessPreambleRecipient ();
				frame.ProcessPreambleAckRecipient ();
			}
		}
		protected override void OnOpen (TimeSpan timeout)
		{
			DateTime start = DateTime.Now;

			// FIXME: use timeout
			frame = new TcpBinaryFrameManager (TcpBinaryFrameManager.SingletonUnsizedMode, server, true) { Encoder = this.Encoder, EncodingRecord = TcpBinaryFrameManager.EncodingBinary };
			frame.ProcessPreambleRecipient ();
			frame.ProcessPreambleAckRecipient ();
		}