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


C# IConnection.BeginWrite方法代码示例

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


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

示例1: SendPreambleAsyncResult

 public SendPreambleAsyncResult(StreamedFramingRequestChannel channel, IConnection connection, ref TimeoutHelper timeoutHelper, ClientFramingDecoder decoder, AsyncCallback callback, object state) : base(callback, state)
 {
     this.channel = channel;
     this.connection = connection;
     this.timeoutHelper = timeoutHelper;
     this.decoder = decoder;
     IAsyncResult result = connection.BeginWrite(channel.Preamble, 0, channel.Preamble.Length, true, timeoutHelper.RemainingTime(), onWritePreamble, this);
     if (result.CompletedSynchronously && this.HandleWritePreamble(result))
     {
         base.Complete(true);
     }
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:12,代码来源:StreamedFramingRequestChannel.cs

示例2: HandleUpgrade

                bool HandleUpgrade(IAsyncResult result)
                {
                    connection = ConnectionUpgradeHelper.EndInitiateUpgrade(result);

                    if (this.channelBindingProvider != null && this.channelBindingProvider.IsChannelBindingSupportEnabled)
                    {
                        this.channel.channelBindingToken = this.channelBindingProvider.GetChannelBinding(this.upgradeInitiator, ChannelBindingKind.Endpoint);
                    }

                    this.remoteSecurity = StreamSecurityUpgradeInitiator.GetRemoteSecurity(this.upgradeInitiator);
                    this.upgradeInitiator = null; // we're done with the initiator
                    if (onWritePreambleEnd == null)
                    {
                        onWritePreambleEnd = Fx.ThunkCallback(new WaitCallback(OnWritePreambleEnd));
                    }

                    AsyncCompletionResult writePreambleResult = connection.BeginWrite(
                        ClientSingletonEncoder.PreambleEndBytes, 0, ClientSingletonEncoder.PreambleEndBytes.Length, true,
                        timeoutHelper.RemainingTime(), onWritePreambleEnd, this);

                    if (writePreambleResult == AsyncCompletionResult.Queued)
                    {
                        return false;
                    }

                    connection.EndWrite();
                    return ReadPreambleAck();
                }
开发者ID:nlh774,项目名称:DotNetReferenceSource,代码行数:28,代码来源:StreamedFramingRequestChannel.cs

示例3: WriteAsyncResult

 public WriteAsyncResult(IConnection connection, byte[] buffer, int offset, int count, bool immediate, TimeSpan timeout, AsyncCallback callback, object state)
     : base(connection, callback, state)
 {
     AsyncCompletionResult writeResult = connection.BeginWrite(buffer, offset, count, immediate, timeout, GetWaitCompletion(), this);
     if (writeResult == AsyncCompletionResult.Completed)
     {
         HandleIO(connection);
         base.Complete(true);
     }
 }
开发者ID:iskiselev,项目名称:JSIL.NetFramework,代码行数:10,代码来源:Connection.cs

示例4: SendPreambleAsyncResult

                public SendPreambleAsyncResult(StreamedFramingRequestChannel channel, IConnection connection,
                    ref TimeoutHelper timeoutHelper, ClientFramingDecoder decoder, AsyncCallback callback, object state)
                    : base(callback, state)
                {
                    this.channel = channel;
                    this.connection = connection;
                    this.timeoutHelper = timeoutHelper;
                    this.decoder = decoder;

                    AsyncCompletionResult writePreambleResult = connection.BeginWrite(channel.Preamble, 0, channel.Preamble.Length,
                        true, timeoutHelper.RemainingTime(), onWritePreamble, this);

                    if (writePreambleResult == AsyncCompletionResult.Queued)
                    {
                        return;
                    }

                    if (HandleWritePreamble())
                    {
                        base.Complete(true);
                    }
                }
开发者ID:nlh774,项目名称:DotNetReferenceSource,代码行数:22,代码来源:StreamedFramingRequestChannel.cs

示例5: WriteMessageAsyncResult

 public WriteMessageAsyncResult(Message message, IConnection connection, bool isRequest, IConnectionOrientedTransportFactorySettings settings, ref TimeoutHelper timeoutHelper, AsyncCallback callback, object state) : base(callback, state)
 {
     this.connection = connection;
     this.encoder = settings.MessageEncoderFactory.Encoder;
     this.bufferManager = settings.BufferManager;
     this.timeoutHelper = timeoutHelper;
     this.message = message;
     this.settings = settings;
     bool flag = true;
     bool flag2 = false;
     if (message == null)
     {
         if (isRequest)
         {
             this.endBytes = SingletonEncoder.EndBytes;
         }
         flag2 = this.WriteEndBytes();
     }
     else
     {
         try
         {
             bool flag3;
             byte[] envelopeStartBytes = SingletonEncoder.EnvelopeStartBytes;
             if (isRequest)
             {
                 this.endBytes = SingletonEncoder.EnvelopeEndFramingEndBytes;
                 flag3 = TransferModeHelper.IsRequestStreamed(settings.TransferMode);
             }
             else
             {
                 this.endBytes = SingletonEncoder.EnvelopeEndBytes;
                 flag3 = TransferModeHelper.IsResponseStreamed(settings.TransferMode);
             }
             if (flag3)
             {
                 if (onWriteStartBytes == null)
                 {
                     onWriteStartBytes = Fx.ThunkCallback(new AsyncCallback(StreamingConnectionHelper.WriteMessageAsyncResult.OnWriteStartBytes));
                 }
                 IAsyncResult result = connection.BeginWrite(envelopeStartBytes, 0, envelopeStartBytes.Length, true, timeoutHelper.RemainingTime(), onWriteStartBytes, this);
                 if (result.CompletedSynchronously)
                 {
                     if (onWriteStartBytesScheduled == null)
                     {
                         onWriteStartBytesScheduled = new Action<object>(StreamingConnectionHelper.WriteMessageAsyncResult.OnWriteStartBytesScheduled);
                     }
                     ActionItem.Schedule(onWriteStartBytesScheduled, result);
                 }
             }
             else
             {
                 ArraySegment<byte> segment = SingletonEncoder.EncodeMessageFrame(settings.MessageEncoderFactory.Encoder.WriteMessage(message, 0x7fffffff, this.bufferManager, envelopeStartBytes.Length + 5));
                 this.bufferToFree = segment.Array;
                 Buffer.BlockCopy(envelopeStartBytes, 0, segment.Array, segment.Offset - envelopeStartBytes.Length, envelopeStartBytes.Length);
                 if (onWriteBufferedMessage == null)
                 {
                     onWriteBufferedMessage = Fx.ThunkCallback(new AsyncCallback(StreamingConnectionHelper.WriteMessageAsyncResult.OnWriteBufferedMessage));
                 }
                 IAsyncResult result2 = connection.BeginWrite(segment.Array, segment.Offset - envelopeStartBytes.Length, segment.Count + envelopeStartBytes.Length, true, timeoutHelper.RemainingTime(), onWriteBufferedMessage, this);
                 if (result2.CompletedSynchronously)
                 {
                     flag2 = this.HandleWriteBufferedMessage(result2);
                 }
             }
             flag = false;
         }
         finally
         {
             if (flag)
             {
                 this.Cleanup();
             }
         }
     }
     if (flag2)
     {
         base.Complete(true);
     }
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:80,代码来源:StreamingConnectionHelper.cs


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