コード例 #1
0
        internal protected void OnSendInternal(int bytesTransferred)
        {
            Diag.AddBytesSent(bytesTransferred);

            lock (syncRoot)
            {
                if (disposed)
                {
                    txFlag = false;
                    return;
                }
            }

            if (Config.TraceLevel <= TraceLevel.Trace)
            {
                for (int i = 0; i < txBuffers.Count; ++i)
                {
                    SendBuffer sendBuffer = txBuffers[i];

                    Trace.Log("{0} {1} sent head {2}: {3}", link.Name,
                              InternalHandle, sendBuffer.HeaderLength,
                              BitConverter.ToString(sendBuffer.HeaderBytes, 0, sendBuffer.HeaderLength));
                    Trace.Log("{0} {1} sent body {2}: {3}", link.Name,
                              InternalHandle, sendBuffer.Buffer.Length,
                              sendBuffer.Buffer.ToHexString());
                }
            }

            Trace.Log("{0} {1} sent {2}/{3} byte(s)",
                      link.Name, InternalHandle, bytesTransferred, lengthToSend);

            lock (syncRoot)
            {
                if (eventsToSend.Count == 0)
                {
                    eventsSending.Clear();
                    txFlag = false;
                    return;
                }
            }

            BeginSend();
        }
コード例 #2
0
        protected void OnSendToInternal(int bytesTransferred)
        {
            if (bytesTransferred != 0)
            {
                Diag.AddBytesSent(bytesTransferred);
            }

            Event e;

            lock (syncRoot)
            {
                if (txQueue.Count == 0)
                {
                    txFlag = false;
                    return;
                }
                e = txQueue.Dequeue();
            }

            BeginSendTo(e);
        }