Exemple #1
0
 public static IObservable <TcpClientTermination> ServeTcp <TSource>(
     this IQbservable <TSource> source,
     IPEndPoint endPoint,
     IRemotingFormatter formatter)
 {
     return(QbservableTcpServer.CreateService <object, TSource>(endPoint, formatter, _ => source));
 }
Exemple #2
0
 public static IObservable <TcpClientTermination> ServeTcp <TSource>(
     this IQbservable <TSource> source,
     IPEndPoint endPoint,
     QbservableServiceOptions options)
 {
     return(QbservableTcpServer.CreateService <object, TSource>(endPoint, options, _ => source));
 }
            public IObservable <TcpClientTermination> CreateService(
                IPEndPoint endPoint,
                QbservableServiceOptions options,
                CreateServiceProxyDelegates <TSource, TResult> delegates)
            {
                new PermissionSet(PermissionState.Unrestricted).Assert();

                try
                {
                    InitializeInFullTrust();
                }
                finally
                {
                    PermissionSet.RevertAssert();
                }

                Func <IRemotingFormatter> formatterFactory;
                Func <IObservable <TSource>, IQbservable <TResult> > service;

                /* Retrieving a cross-domain delegate always fails with a SecurityException due to
                 * a Demand for ReflectionPermission, regardless of whether that permission is asserted
                 * here or even whether full trust is asserted (commented line).  It is unclear why the
                 * assertions don't work.  The only solution appears to be that the delegates must
                 * point to public members.
                 *
                 * (Alternatively, adding the ReflectionPermission to the minimum permission set of the
                 * AppDomain works as well, but it's more secure to disallow it entirely to prevent
                 * reflection from executing within clients' expression trees, just in case the host
                 * relaxes the service options to allow unrestricted expressions constrained only by
                 * the minimum AppDomain permissions; i.e., The Principle of Least Surprise.)
                 *
                 * new PermissionSet(PermissionState.Unrestricted).Assert();
                 */

                try
                {
                    formatterFactory = delegates.FormatterFactory;
                    service          = delegates.Service;
                }
                catch (SecurityException ex)
                {
                    throw new ArgumentException(Errors.CreateServiceDelegatesNotPublic, ex);
                }
                finally
                {
                    /* This line is unnecessary - see comments above.
                     * PermissionSet.RevertAssert();
                     */
                }

                return(QbservableTcpServer
                       .CreateService(endPoint, formatterFactory, options, service)
                       .RemotableWithoutConfiguration());
            }
Exemple #4
0
 public QbservableTcpClient(IPEndPoint endPoint, LocalEvaluator localEvaluator)
     : this(endPoint, QbservableTcpServer.CreateDefaultFormatter(), localEvaluator)
 {
 }
Exemple #5
0
 public QbservableTcpClient(IPEndPoint endPoint, params Type[] knownTypes)
     : this(endPoint, QbservableTcpServer.CreateDefaultFormatter(), knownTypes)
 {
 }
Exemple #6
0
 public QbservableTcpClient(IPEndPoint endPoint)
     : this(endPoint, QbservableTcpServer.CreateDefaultFormatter())
 {
 }