Пример #1
0
        /// <summary>
        /// Handler for forwarded connections.
        /// </summary>
        /// <param name="connection">
        /// The connection being forwarded.
        /// </param>
        /// <returns>
        /// True if forwarding was established, false otherwise.
        /// </returns>
        private bool Forwarding(ServiceConnection connection)
        {
            Socket localService = StaticUtilities.CreateConnectedSocket(
                "localhost",
                HomeOS.Hub.Common.Constants.InfoServicePort);

            NetworkStream netstream = new NetworkStream(localService, true /*ownSocket*/);

            if (localService != null)
            {
                Forwarder forwarder = new Forwarder(
                    netstream,
                    connection.GetStream(),
                    this.StopForwarding, null);
                return(true);
            }

            return(false);
        }
Пример #2
0
        /// <summary>
        /// Handler for forwarded connections.
        /// </summary>
        /// <param name="connection">
        /// The connection being forwarded.
        /// </param>
        /// <returns>
        /// True if forwarding was established, false otherwise.
        /// </returns>
        private bool Forwarding(ServiceConnection connection)
        {
            Socket localService = StaticUtilities.CreateConnectedSocket(
                "localhost",
                HomeOS.Hub.Common.Constants.InfoServicePort);

            NetworkStream netstream = new NetworkStream(localService, true /*ownSocket*/);

            if (localService != null)
            {
                Forwarder forwarder = new Forwarder(
                    netstream,
                    connection.GetStream(),
                    this.StopForwarding, null);
                return true;
            }

            return false;
        }