예제 #1
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();
            }
        }
예제 #2
0
        public override Message Request(Message input, TimeSpan timeout)
        {
            DateTime start = DateTime.Now;

            // FIXME: use timeouts.
            frame.ProcessPreambleInitiator();
            frame.ProcessPreambleAckInitiator();

            if (input.Headers.To == null)
            {
                input.Headers.To = RemoteAddress.Uri;
            }
            if (input.Headers.MessageId == null)
            {
                input.Headers.MessageId = new UniqueId();
            }

            frame.WriteUnsizedMessage(input, timeout - (DateTime.Now - start));

            // LAMESPEC: it contradicts the protocol described at section 3.1.1.1.1 in [MC-NMF].
            // Moving this WriteEndRecord() after ReadUnsizedMessage() causes TCP connection blocking.
            frame.WriteEndRecord();

            var ret = frame.ReadUnsizedMessage(timeout - (DateTime.Now - start));

            frame.ReadEndRecord();              // both
            return(ret);
        }
예제 #3
0
		void CreateClient (TimeSpan timeout)
		{
			int explicitPort = Via.Port;
			var stream = new NamedPipeClientStream (".", Via.LocalPath.Substring (1).Replace ('/', '\\'), PipeDirection.InOut);
			stream.Connect ();
			frame = new TcpBinaryFrameManager (TcpBinaryFrameManager.SingletonUnsizedMode, stream, false) {
				Encoder = this.Encoder,
				Via = this.Via };
			frame.ProcessPreambleInitiator ();
			frame.ProcessPreambleAckInitiator ();
		}
예제 #4
0
        void CreateClient(TimeSpan timeout)
        {
            int explicitPort = Via.Port;
            var stream       = new NamedPipeClientStream(".", Via.LocalPath.Substring(1).Replace('/', '\\'), PipeDirection.InOut);

            stream.Connect();
            frame = new TcpBinaryFrameManager(TcpBinaryFrameManager.SingletonUnsizedMode, stream, false)
            {
                Encoder = this.Encoder,
                Via     = this.Via
            };
            frame.ProcessPreambleInitiator();
            frame.ProcessPreambleAckInitiator();
        }
예제 #5
0
        void CreateClient(TimeSpan timeout)
        {
            int explicitPort = Via.Port;

            client = new TcpClient(Via.Host, explicitPort <= 0 ? TcpTransportBindingElement.DefaultPort : explicitPort);

            NetworkStream ns = client.GetStream();

            frame = new TcpBinaryFrameManager(TcpBinaryFrameManager.SingletonUnsizedMode, ns, false)
            {
                Encoder        = this.Encoder,
                Via            = this.Via,
                EncodingRecord = TcpBinaryFrameManager.EncodingBinary
            };
            frame.ProcessPreambleInitiator();
            frame.ProcessPreambleAckInitiator();
        }
		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 ();
			}
		}