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


C# IClientChannel.Close方法代码示例

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


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

示例1: CloseClientChannel

 public static void CloseClientChannel(IClientChannel c)
 {
     try {
         c.Close();
     } catch {
         c.Abort();
     } finally {
         c.Dispose();
     }
 }
开发者ID:shigasumi,项目名称:NService,代码行数:10,代码来源:NetworkHelper.cs

示例2: CloseChannel

 private static void CloseChannel(IClientChannel channel)
 {
     try
     {
         channel.Close();
     }
     catch (TimeoutException)
     {
         channel.Abort();
     }
     catch (CommunicationException)
     {
         channel.Abort();
     }
     catch (Exception)
     {
         channel.Abort();
         throw;
     }
 }
开发者ID:saggett,项目名称:ReligionsTree,代码行数:20,代码来源:ServiceProxyHolder.cs

示例3: AfterSendAsync

 /// <summary>
 /// After sending, we check if the write was successful or if it was a fire-and-forget.
 /// </summary>
 /// <param name="sendTask">The task of the send operation.</param>
 /// <param name="tcsResponse"></param>
 /// <param name="isFireAndForget">True, if we don't expect a response message.</param>
 /// <param name="channel"></param>
 private async Task AfterSendAsync(Task sendTask, TaskCompletionSource<Message.Message> tcsResponse, bool isFireAndForget, IClientChannel channel)
 {
     // TODO use for UDP connections, too
     await sendTask;
     if (sendTask.IsFaulted)
     {
         string msg = String.Format("Failed to write channel the request {0} {1}.", tcsResponse.Task.AsyncState,
             sendTask.Exception);
         Logger.Warn(msg);
         tcsResponse.SetException(sendTask.TryGetException());
     }
     if (isFireAndForget)
     {
         Logger.Debug("Fire and forget message {0} sent. Close channel {1} now. {0}", tcsResponse.Task.AsyncState, channel);
         tcsResponse.SetResult(null); // set FF result
         // close channel now
     }
     else
     {
         //.NET specific, we wait here for the response
         // receive response message
         // processes client-side inbound pipeline
         await channel.ReceiveMessageAsync();
     }
     channel.Close(); // TODO not needed, receive method closes...
 }
开发者ID:pacificIT,项目名称:TomP2P.NET,代码行数:33,代码来源:Sender.cs


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