当前位置: 首页>>代码示例>>C#>>正文


C# BinaryServerFormatterSinkProvider.GetType方法代码示例

本文整理汇总了C#中System.Runtime.Remoting.Channels.BinaryServerFormatterSinkProvider.GetType方法的典型用法代码示例。如果您正苦于以下问题:C# BinaryServerFormatterSinkProvider.GetType方法的具体用法?C# BinaryServerFormatterSinkProvider.GetType怎么用?C# BinaryServerFormatterSinkProvider.GetType使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在System.Runtime.Remoting.Channels.BinaryServerFormatterSinkProvider的用法示例。


在下文中一共展示了BinaryServerFormatterSinkProvider.GetType方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: GenuineUniversalServerTransportSink

        /// <summary>
        /// To avoid a problem inside MS code that can happen once per 380 thousand requests on multiCPU machines.
        /// </summary>
        static GenuineUniversalServerTransportSink()
        {
            // remove the damned pool
            BinaryServerFormatterSinkProvider binaryServerFormatterSinkProvider = new BinaryServerFormatterSinkProvider();
            Type coreChannelType = binaryServerFormatterSinkProvider.GetType().Assembly.GetType("System.Runtime.Remoting.Channels.CoreChannel");
            Type byteBufferAllocator = binaryServerFormatterSinkProvider.GetType().Assembly.GetType("System.IO.ByteBufferAllocator");

            FieldInfo _bufferPool = coreChannelType.GetField("_bufferPool", BindingFlags.NonPublic | BindingFlags.Static);
            ConstructorInfo constructorInfo = byteBufferAllocator.GetConstructor(new Type[] { typeof(Int32) } );

            _bufferPool.SetValue(null, constructorInfo.Invoke(new object[] { 0x1000 } ));
        }
开发者ID:ArsenShnurkov,项目名称:GenuineChannels,代码行数:15,代码来源:GenuineUniversalServerTransportSink.cs

示例2: CreateTcpChannel

		/// <summary>
		///  Create a TcpChannel with a given name, on a given port.
		/// </summary>
		/// <param name="port"></param>
		/// <param name="name"></param>
		/// <returns></returns>
		private static TcpChannel CreateTcpChannel( string name, int port, int limit )
		{
			ListDictionary props = new ListDictionary();
			props.Add( "port", port );
			props.Add( "name", name );
			props.Add( "bindTo", "127.0.0.1" );

			BinaryServerFormatterSinkProvider serverProvider =
				new BinaryServerFormatterSinkProvider();

            // NOTE: TypeFilterLevel and "clientConnectionLimit" property don't exist in .NET 1.0.
			Type typeFilterLevelType = typeof(object).Assembly.GetType("System.Runtime.Serialization.Formatters.TypeFilterLevel");
			if (typeFilterLevelType != null)
			{
				PropertyInfo typeFilterLevelProperty = serverProvider.GetType().GetProperty("TypeFilterLevel");
				object typeFilterLevel = Enum.Parse(typeFilterLevelType, "Full");
				typeFilterLevelProperty.SetValue(serverProvider, typeFilterLevel, null);

//                props.Add("clientConnectionLimit", limit);
            }

			BinaryClientFormatterSinkProvider clientProvider =
				new BinaryClientFormatterSinkProvider();

			return new TcpChannel( props, clientProvider, serverProvider );
		}
开发者ID:Vernathic,项目名称:ic-AutoTest.NET4CTDD,代码行数:32,代码来源:ServerUtilities.cs

示例3: GetTcpChannel

        public static TcpChannel GetTcpChannel( IDictionary properties )
        {
            BinaryServerFormatterSinkProvider serverProvider =
                new BinaryServerFormatterSinkProvider();

            // NOTE: The TypeFilterLevel enum/propety doesn't exist in .NET 1.0.
            Type typeFilterLevelType = typeof(object).Assembly.GetType("System.Runtime.Serialization.Formatters.TypeFilterLevel");
            if (typeFilterLevelType != null)
            {
                PropertyInfo typeFilterLevelProperty = serverProvider.GetType().GetProperty("TypeFilterLevel");
                object typeFilterLevel = Enum.Parse(typeFilterLevelType, "Full");
                typeFilterLevelProperty.SetValue(serverProvider, typeFilterLevel, null);
            }

            BinaryClientFormatterSinkProvider clientProvider =
                new BinaryClientFormatterSinkProvider();

            return new TcpChannel( properties, clientProvider, serverProvider );
        }
开发者ID:fotisp,项目名称:conqat,代码行数:19,代码来源:ServerUtilities.cs


注:本文中的System.Runtime.Remoting.Channels.BinaryServerFormatterSinkProvider.GetType方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。