Пример #1
0
        public override uint SendAsync(SNIPacket packet, bool disposePacketAfterSendAsync, SNIAsyncCallback callback = null)
        {
            SNIAsyncCallback cb = callback ?? _sendCallback;

            packet.WriteToStreamAsync(_stream, cb, SNIProviders.NP_PROV, disposePacketAfterSendAsync);
            return(TdsEnums.SNI_SUCCESS_IO_PENDING);
        }
Пример #2
0
        /// <summary>
        /// Send a packet asynchronously
        /// </summary>
        /// <param name="packet">SNI packet</param>
        /// <param name="callback">Completion callback</param>
        /// <returns>SNI error code</returns>
        public override uint SendAsync(SNIPacket packet, SNIAsyncCallback callback = null)
        {
            SNIAsyncCallback cb = callback ?? _sendCallback;

            lock (this)
            {
                packet.WriteToStreamAsync(_stream, cb, SNIProviders.TCP_PROV);
            }
            return(TdsEnums.SNI_SUCCESS_IO_PENDING);
        }
Пример #3
0
 public override uint SendAsync(SNIPacket packet, SNIAsyncCallback callback = null)
 {
     using (TrySNIEventScope.Create(nameof(SNINpHandle)))
     {
         SNIAsyncCallback cb = callback ?? _sendCallback;
         SqlClientEventSource.Log.TrySNITraceEvent(nameof(SNINpHandle), EventType.INFO, "Connection Id {0}, Packet writing to stream, dataLeft {1}", args0: _connectionId, args1: packet?.DataLeft);
         packet.WriteToStreamAsync(_stream, cb, SNIProviders.NP_PROV);
         return(TdsEnums.SNI_SUCCESS_IO_PENDING);
     }
 }
Пример #4
0
 /// <summary>
 /// Send a packet asynchronously
 /// </summary>
 /// <param name="packet">SNI packet</param>
 /// <param name="callback">Completion callback</param>
 /// <returns>SNI error code</returns>
 public override uint SendAsync(SNIPacket packet, SNIAsyncCallback callback = null)
 {
     using (TrySNIEventScope.Create(nameof(SNITCPHandle)))
     {
         SNIAsyncCallback cb = callback ?? _sendCallback;
         packet.WriteToStreamAsync(_stream, cb, SNIProviders.TCP_PROV);
         SqlClientEventSource.Log.TrySNITraceEvent(nameof(SNITCPHandle), EventType.INFO, "Connection Id {0}, Data sent to stream asynchronously", args0: _connectionId);
         return(TdsEnums.SNI_SUCCESS_IO_PENDING);
     }
 }
Пример #5
0
        public override uint SendAsync(SNIPacket packet, SNIAsyncCallback callback = null)
        {
            long scopeID = SqlClientEventSource.Log.TrySNIScopeEnterEvent("<sc.SNI.SNINpHandle.SendAsync |SNI|SCOPE>");

            try
            {
                SNIAsyncCallback cb = callback ?? _sendCallback;
                packet.WriteToStreamAsync(_stream, cb, SNIProviders.NP_PROV);
                return(TdsEnums.SNI_SUCCESS_IO_PENDING);
            }
            finally
            {
                SqlClientEventSource.Log.TrySNIScopeLeaveEvent(scopeID);
            }
        }
Пример #6
0
        /// <summary>
        /// Send a packet asynchronously
        /// </summary>
        /// <param name="packet">SNI packet</param>
        /// <param name="callback">Completion callback</param>
        /// <returns>SNI error code</returns>
        public override uint SendAsync(SNIPacket packet, SNIAsyncCallback callback = null)
        {
            long scopeID = SqlClientEventSource.Log.TrySNIScopeEnterEvent(s_className);

            try
            {
                SNIAsyncCallback cb = callback ?? _sendCallback;
                packet.WriteToStreamAsync(_stream, cb, SNIProviders.TCP_PROV);
                SqlClientEventSource.Log.TrySNITraceEvent(s_className, EventType.INFO, "Connection Id {0}, Data sent to stream asynchronously", args0: _connectionId);
                return(TdsEnums.SNI_SUCCESS_IO_PENDING);
            }
            finally
            {
                SqlClientEventSource.Log.TrySNIScopeLeaveEvent(scopeID);
            }
        }