1.连接数,我看到网上关于连接数的设置,可以增大到想要的数量,但有一个疑问,这和操作系统有关吗?例如,用
XP和Server 2008是否都是一样的?2.客户端正常退出时是否需要显式的关闭连接?因为我将连接的ReceiveTimeout设得很大,如果不主动关闭,是否会
占用连接数?如果需要关闭,请问怎样关闭。我没有找到相应的方法。下面是我的代码:NetTcpBinding oBinding = new NetTcpBinding();
oBinding.Name = "tcpbinding";
oBinding.TransactionFlow = false; //是否支持分布式事务
oBinding.TransferMode = TransferMode.Buffered;
oBinding.TransactionProtocol = TransactionProtocol.OleTransactions;
oBinding.ReceiveTimeout = new TimeSpan(10, 10, 10);
oBinding.MaxReceivedMessageSize = 2147483647; oBinding.Security.Mode = SecurityMode.None;
oBinding.Security.Message.ClientCredentialType = MessageCredentialType.Certificate; ChannelFactory<Star.BusinessServiceInterface.IObjectMaster> oFactory = new ChannelFactory<Star.BusinessServiceInterface.IObjectMaster>(oBinding, MyGlobal.SSConnectString);
MyGlobal.ServiceObject = oFactory.CreateChannel();
请高手指教!
XP和Server 2008是否都是一样的?2.客户端正常退出时是否需要显式的关闭连接?因为我将连接的ReceiveTimeout设得很大,如果不主动关闭,是否会
占用连接数?如果需要关闭,请问怎样关闭。我没有找到相应的方法。下面是我的代码:NetTcpBinding oBinding = new NetTcpBinding();
oBinding.Name = "tcpbinding";
oBinding.TransactionFlow = false; //是否支持分布式事务
oBinding.TransferMode = TransferMode.Buffered;
oBinding.TransactionProtocol = TransactionProtocol.OleTransactions;
oBinding.ReceiveTimeout = new TimeSpan(10, 10, 10);
oBinding.MaxReceivedMessageSize = 2147483647; oBinding.Security.Mode = SecurityMode.None;
oBinding.Security.Message.ClientCredentialType = MessageCredentialType.Certificate; ChannelFactory<Star.BusinessServiceInterface.IObjectMaster> oFactory = new ChannelFactory<Star.BusinessServiceInterface.IObjectMaster>(oBinding, MyGlobal.SSConnectString);
MyGlobal.ServiceObject = oFactory.CreateChannel();
请高手指教!
ReceiveTimeout是你接收数据的超时时间,也就是如果你跟服务器请求一个很到的数据的时候,你ReceiveTimeout设置为1分钟的话,服务器需要2分钟才能把数据传完,那么就会请求超时。
结果是我在启动程序后让它停在那里,中间如果20分钟没有再和服务端交互的话,20分钟后再要和服务端交
互,会提示已经连接不到服务端了。