对于每个客户端的,服务端是否为每个客户端有专门的“通道”?

目的:想在服务端记录下来客户端的访问记录(进入、各个操作、离开等信息),并将其执行的操作独立记录在各个客户端对应的日志中。

下面是代码:

契约

    [ServiceContract]
public interface IService
{ [OperationContract]
string GetData(string value); }

服务

    public class Service : IService
{ public string GetData(string value)
{ string result = string.Format("Enter:{0}\t{1}\t{2}", value, GetClientIP(), AppDomain.CurrentDomain.ToString());
Log(result);
System.Threading.Thread.Sleep(); Log("Leave:{0}\t{1}", value, GetClientIP());
return result; }
}

客户端

System.Timers.Timer timer1 = new System.Timers.Timer();
timer1.Interval = ;
timer1.Elapsed +=
delegate
{
while (true)
{ ChannelFactory<IService> channelFatory = GetChannelFactory<IService>("BasicHttpBinding_IService1"); IService1 calculator = channelFatory.CreateChannel();
try
{
Console.WriteLine(calculator.GetData(IP));
}
finally
{
CloseConnection((calculator as ICommunicationObject));
} }
};
timer1.Start();

最后证明:服务为每个客户端连接开辟了单独的通道。不知道我的理解正确不。。。。待续

最新文章

  1. iOS UITableView , UITableViewController ,UITableViewCell实现全国各省市遍历,选择相应的地区
  2. BZOJ3293: [Cqoi2011]分金币
  3. 抄书 Copying Books UVa 714
  4. pH 值与曝气对硝化细菌硝化作用的影响
  5. chrome升级54以后,显示Adobe Flash Player 因过期而遭到阻止
  6. windows下 berkerly db的安装配置(修正了关键步骤)
  7. ASP.NET-FineUI开发实践-16(二)
  8. CXF之webservice
  9. GridBagLayout练习
  10. WCF订阅替换轮训
  11. webqq的注册登记和聊天页面--运用jsonp跨域
  12. PHP求解一个值是否为质数
  13. JSON 数据重复 出现$ref
  14. SQL优化指南
  15. properties文件操作
  16. 第 10 章 容器监控 - 079 - 监控利器 sysdig
  17. scrapy 爬取斗罗大陆漫画
  18. 在 C 代码中嵌入 Python 语句或使用 Python 模块 (Visual Studio 2013 环境设置)
  19. 跟我学SharePoint 2013视频培训课程——什么是SharePoint 2013(1)
  20. 2.6 CMMI2级——供应商协议管理(Supplier Agreement Management)

热门文章

  1. Eclipse中安装JBoss Tools插件
  2. SVN文件排除
  3. windows下安装配置apacheserver
  4. /proc/interrupts 和 /proc/stat 查看中断的情况
  5. android monkey app乱点测试
  6. google cloud之查看任务任务过程
  7. 对于try catch放在能够很好地处理例外的位置
  8. php -- PDO异常处理
  9. Codeforces Round #266 (Div. 2)
  10. java中不用BigInteger实现超大整数的乘法操作