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


C# SocketState.GetEdge方法代码示例

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


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

示例1: HandleWrites

 protected void HandleWrites(SocketState ss) {
   ArrayList socks = ss.WriteSocks;
   for(int i = 0; i < socks.Count; i++) {
     Socket s = (Socket)socks[i];
     CreationState cs = ss.TakeCreationState( s );
     if( cs != null ) {
       cs.HandleWritability(s);
     }
     else {
       //Let's try to flush the buffer:
       try {
         ss.FlushSocket(s);
       }
       catch {
         /*
          * We should close this edge
          */
         TcpEdge tcpe = ss.GetEdge(s);
         TEL.RequestClose(tcpe);
         //Go ahead and forget about this socket.
         CloseAction ca = new CloseAction(tcpe, null);
         ca.Start(ss);
       }
     }
   }
 }
开发者ID:xujyan,项目名称:brunet,代码行数:26,代码来源:TcpEdgeListener.cs

示例2: Start

 public override void Start(SocketState ss) {
   /*
    * Note, we are the only thread running actions from the queue,
    * so, no change to ss can happen concurrently with this logic
    */
   ArrayList close_actions = new ArrayList();
   foreach(Socket s in ss.AllSockets) {
     TcpEdge e = ss.GetEdge(s);
     TEL.RequestClose(e);
     /*
      * We can't just call ca.Start(ss) because that
      * would change ss.AllSockets
      */
     close_actions.Add(new CloseAction(e, null));
   }
   foreach(CloseAction ca in close_actions) {
     ca.Start(ss);
   }
   //Close the main socket:
   ss.ListenSock.Close();
 }
开发者ID:xujyan,项目名称:brunet,代码行数:21,代码来源:TcpEdgeListener.cs


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